const Duplex = require('readable-stream').Duplex const inherits = require('util').inherits module.exports = LocalMessageDuplexStream inherits(LocalMessageDuplexStream, Duplex) function LocalMessageDuplexStream (opts) { Duplex.call(this, { objectMode: true, }) // this._origin = opts.origin this._name = opts.name this._target = opts.target // console.log('LocalMessageDuplexStream ('+this._name+') - initialized...') window.addEventListener('message', this._onMessage.bind(this), false) } // private LocalMessageDuplexStream.prototype._onMessage = function (event) { var msg = event.data // console.log('LocalMessageDuplexStream ('+this._name+') - heard message...', event) // validate message if (event.origin !== location.origin) return // console.log('LocalMessageDuplexStream ('+this._name+') - rejected - (event.origin !== location.origin) ') if (typeof msg !== 'object') return // console.log('LocalMessageDuplexStream ('+this._name+') - rejected - (typeof msg !== "object") ') if (msg.target !== this._name) return // console.log('LocalMessageDuplexStream ('+this._name+') - rejected - (msg.target !== this._name) ', msg.target, this._name) if (!msg.data) return // console.log('LocalMessageDuplexStream ('+this._name+') - rejected - (!msg.data) ') // console.log('LocalMessageDuplexStream ('+this._name+') - accepted', msg.data) // forward message try { this.push(msg.data) } catch (err) { this.emit('error', err) } } // stream plumbing LocalMessageDuplexStream.prototype._read = noop LocalMessageDuplexStream.prototype._write = function (data, encoding, cb) { // console.log('LocalMessageDuplexStream ('+this._name+') - sending message...') var message = { target: this._target, data: data, } window.postMessage(message, location.origin) cb() } // util function noop () {} FreeBSD GNOME current development ports (https://github.com/freebsd/freebsd-ports-gnome)
aboutsummaryrefslogtreecommitdiffstats
path: root/editors/fxite
Commit message (Expand)AuthorAgeFilesLines
* Update the default version of GCC in the Ports Collection from GCC 4.7.4gerald2014-09-111-1/+1
* - Disable FOX 1.7 support for now, as it's broken. This should be fixed in thegahr2014-09-021-2/+2
* - Add LICENSEgahr2014-07-301-0/+2
* - Remove compiler flags not understood by GCCgahr2014-07-243-1/+23
* Remove indefinite articles and trailing periods from COMMENT, plusolgeni2014-06-101-1/+1
* Replace lang/lua with the new lang/lua51bapt2014-05-261-3/+3
* - Update to 0.92gahr2014-01-232-9/+6
* - Remove manual creation and removal of share/applications, as it's now in th...amdmi32013-10-221-1/+0
* - Bump PORTREVISION on ports dependent on FOX. This is needed because wegahr2013-10-071-1/+1
* Add NO_STAGE all over the place in preparation for the staging support (cat: ...bapt2013-09-211-0/+1
* - Fix build with upcoming FOX 1.7.42gahr2013-09-181-0/+15
* - Fix build with fox-1.7gahr2013-09-171-0/+2
* - Bump PORTREVISION on ports that (might) depend on x11-toolkits/fox17gahr2013-08-291-1/+1
* - Chase x11-toolkits/fox16 shlib version bumpgahr2013-04-241-0/+1
* Convert e* to USES=pkgconfigbapt2013-04-231-1/+1
* - Update to 0.91gahr2013-04-223-18/+46
* - Fix PLISTgahr2013-04-031-0/+1
* - Update to 0.9gahr2012-11-272-10/+7
* - Chase x11-toolkits/fox16 shlib version bumpgahr2012-07-131-1/+1
* - update png to 1.5.10dinoex2012-06-011-1/+1
* - Chase x11-toolkits/fox16 shlib bumpgahr2012-05-021-1/+1
* - Substitute invalid USE_PKGCONFIG variable with USE_GNOME= pkgconfig [1]gahr2012-02-151-1/+1
* - Add LDFLAGS to CONFIGURE_ENV and MAKE_ENV (as it was done with LDFLAGS)amdmi32011-09-241-1/+0
* - Unbreak on < 800067.gahr2011-08-301-2/+5
* - Mark as broken on < 800067. The port needs getline(3).gahr2011-08-291-1/+7
* - Update to 0.7gahr2011-08-222-7/+13
* - Mark BROKEN: does not compilepav2011-07-121-6/+3