Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
This commit is contained in:
parent
93e3a48004
commit
b38dea0597
25901 changed files with 9982925 additions and 369 deletions
3
assets/webapps/sms.gaiamobile.org/lib/bridge/client.js
Normal file
3
assets/webapps/sms.gaiamobile.org/lib/bridge/client.js
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,4 @@
|
|||
;!((define)=>{define((require,exports,module)=>{var debug=0?function(arg1,...args){var type=`[${self.constructor.name}][${location.pathname}]`;console.log(`[ClientStream]${type} - "${arg1}"`,...args);}:()=>{};module.exports=(client,utils)=>{client._activeStreams=[];client.on('streamevent',onStreamEvent);client.stream=function(name){debug('stream open',name);var args=[].slice.call(arguments,1);var stream=new ClientStream(client,utils);var self=this;this.method('_stream',name,stream.id,this.id,args).then(()=>{debug('stream connected',name);stream._connected.resolve();}).catch(err=>{debug('error',err);onStreamEvent({type:'abort',id:stream.id,data:err});});this._activeStreams[stream.id]=stream;stream.emitter.on('cancel',onEnd);stream.emitter.on('abort',onEnd);stream.emitter.on('close',onEnd);function onEnd(){debug('end');delete self._activeStreams[stream.id];stream.destroy();}
|
||||
return stream;};function onStreamEvent(data){debug('stream event',data.type);var stream=client._activeStreams[data.streamId];stream.emitter.emit(data.type,data.data);}};function ClientStream(client,utils){this.id=utils.uuid();this.client=client;this.emitter=new utils.Emitter();this.emitter.on('close',this.onClose.bind(this));this.emitter.on('abort',this.onAbort.bind(this));this._connected=defer();this.connected=this._connected.promise;this._closed=defer();this.closed=this._closed.promise;debug('initialized');}
|
||||
ClientStream.prototype={listen(callback){debug('listen',callback);this.emitter.on('write',callback);},unlisten(callback){debug('unlisten',callback);this.emitter.off('write',callback);},cancel(reason){debug('cancel',reason);return this.client.method('_streamcancel',this.id,reason).then(result=>{debug('cancelled',result);this.emitter.emit('cancel');return result;}).catch(e=>{this.emitter.emit('cancel');});},onAbort(reason){debug('abort',reason);this._closed.reject(reason);},onClose(){debug('close');this._closed.resolve();},destroy(){debug('destroy');this.emitter.off();}};function defer(){var result={};result.promise=new Promise((resolve,reject)=>{result.resolve=resolve;result.reject=reject;});return result;}});})((typeof define)[0]=='f'&&define.amd?define:((n,w)=>{return(typeof
|
||||
module)[0]=='o'?c=>{c(require,exports,module);}:(c)=>{var m={exports:{}};c(n=>w[n],m.exports,m);w[n]=m.exports;};})('streamClient',this));
|
||||
|
|
@ -0,0 +1,206 @@
|
|||
!((define)=>{define((require,exports,module)=>{
|
||||
|
||||
/**
|
||||
* Mini Logger
|
||||
*
|
||||
* @type {Function}
|
||||
*/
|
||||
|
||||
var debug = 0 ? function(arg1, ...args) {
|
||||
var type = `[${self.constructor.name}][${location.pathname}]`;
|
||||
console.log(`[ServiceStream]${type} - "${arg1}"`, ...args);
|
||||
} : () => {};
|
||||
|
||||
module.exports = function(service) {
|
||||
debug('attaching plugin');
|
||||
|
||||
service
|
||||
.method('_stream', onStream)
|
||||
.method('_streamcancel', onStreamCancel);
|
||||
|
||||
service._streamHandlers = {};
|
||||
service._activeStreams = [];
|
||||
|
||||
service.stream = function(name, fn) {
|
||||
debug('register stream', name);
|
||||
this._streamHandlers[name] = fn;
|
||||
return this;
|
||||
};
|
||||
|
||||
function onStream(name, id, clientId, args) {
|
||||
debug('on stream open', name);
|
||||
var e = {
|
||||
preventDefault: () => e.defaultPrevented = true,
|
||||
arguments: arguments
|
||||
};
|
||||
|
||||
// Allow other plugins to override default behaviour
|
||||
service.emit('before-stream', e);
|
||||
if (e.defaultPrevented) return;
|
||||
|
||||
var fn = service._streamHandlers[name];
|
||||
if (!fn) throw error(1, name);
|
||||
|
||||
var stream = new ServiceStream(id, service, clientId);
|
||||
service._activeStreams[id] = stream;
|
||||
|
||||
// Always pass stream object as first
|
||||
// argument to simplify the process
|
||||
fn.apply(service, [stream].concat(args));
|
||||
}
|
||||
|
||||
function onStreamCancel(id, reason) {
|
||||
debug('stream cancel');
|
||||
var stream = service._activeStreams[id];
|
||||
delete service._activeStreams[id];
|
||||
return stream.cancel(reason);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Writable Stream instance passed to the
|
||||
* `service.stream` implementation
|
||||
*
|
||||
* @param {Object} options
|
||||
* @param {String} options.id Stream ID used to sync client and service streams
|
||||
* @param {BroadcastChannel} options.channel Channel used to postMessage
|
||||
* @param {String} options.serviceId ID of the service
|
||||
* @param {String} options.clientId ID of client that should receive message
|
||||
*/
|
||||
|
||||
function ServiceStream(streamId, service, clientId) {
|
||||
this.id = streamId;
|
||||
this.service = service;
|
||||
this.clientId = clientId;
|
||||
this.writable = true;
|
||||
debug('initialized');
|
||||
}
|
||||
|
||||
/**
|
||||
* Prototype assigned to variable
|
||||
* to improve compression.
|
||||
*
|
||||
* @type {Object}
|
||||
*/
|
||||
|
||||
var ServiceStreamPrototype = ServiceStream.prototype;
|
||||
|
||||
/**
|
||||
* Services that allows clients to
|
||||
* cancel the operation before it's
|
||||
* complete should override the
|
||||
* `stream.cancel` method.
|
||||
*
|
||||
* @param {*} [reason] Data sent from client about the cancellation
|
||||
* @returns {(Promise|*)}
|
||||
*/
|
||||
|
||||
ServiceStreamPrototype.cancel = function(reason) {
|
||||
var err = new TypeError('service should implement stream.cancel()');
|
||||
return Promise.reject(err);
|
||||
};
|
||||
|
||||
/**
|
||||
* Signal to client that action was
|
||||
* aborted during the process, this
|
||||
* should be used as a way to
|
||||
* communicate errors.
|
||||
*
|
||||
* @param {*} [data] Reason of failure
|
||||
* @returns {Promise}
|
||||
* @public
|
||||
*/
|
||||
|
||||
ServiceStreamPrototype.abort = function(data) {
|
||||
debug('abort', data);
|
||||
this._post('abort', data);
|
||||
this.writable = false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Sends a chunk of data to the client.
|
||||
*
|
||||
* @param {*} data Chunk of data to be sent to client.
|
||||
* @returns {Promise}
|
||||
* @public
|
||||
*/
|
||||
|
||||
ServiceStreamPrototype.write = function(data) {
|
||||
debug('write', data);
|
||||
this._post('write', data);
|
||||
};
|
||||
|
||||
/**
|
||||
* Closes the stream, signals that
|
||||
* action was completed with success.
|
||||
*
|
||||
* According to whatwg streams spec,
|
||||
* WritableStream#close() doesn't send data.
|
||||
*
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
ServiceStreamPrototype.close = function() {
|
||||
debug('close');
|
||||
this._post('close');
|
||||
this.writable = false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Validate the current state and
|
||||
* call cancel on the target stream.
|
||||
*
|
||||
* Called by the Service when client
|
||||
* sends a 'streamcancel' message.
|
||||
*
|
||||
* @param {*} [reason] Reason for cancelation sent by the client
|
||||
* @returns {Promise}
|
||||
* @private
|
||||
*/
|
||||
|
||||
ServiceStreamPrototype._cancel = function(reason) {
|
||||
debug('cancel', reason);
|
||||
return this.cancel(reason)
|
||||
.then(result => {
|
||||
this.writable = false;
|
||||
return result;
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Validate the current state and post message to client.
|
||||
*
|
||||
* @param {String} type 'write', 'abort' or 'close'
|
||||
* @param {String} state 'writable', 'aborted' or 'closed'
|
||||
* @param {*} [data] Data to be sent to the client
|
||||
* @returns {Promise}
|
||||
* @private
|
||||
*/
|
||||
|
||||
ServiceStreamPrototype._post = function(type, data) {
|
||||
debug('post', type, data, this.writable);
|
||||
if (!this.writable) return Promise.reject();
|
||||
this.service.broadcast('streamevent', {
|
||||
streamId: this.id,
|
||||
type: type,
|
||||
data: data
|
||||
}, [this.clientId]);
|
||||
};
|
||||
|
||||
/**
|
||||
* Create new `Error` from registery.
|
||||
*
|
||||
* @param {Number} id Error Id
|
||||
* @return {Error}
|
||||
* @private
|
||||
*/
|
||||
function error(id) {
|
||||
var args = [].slice.call(arguments, 1);
|
||||
return new Error({
|
||||
1: 'stream "' + args[0] + '" doesn\'t exist'
|
||||
}[id]);
|
||||
}
|
||||
|
||||
});})((typeof define)[0]=='f'&&define.amd?define:((n,w)=>{return(typeof
|
||||
module)[0]=='o'?c=>{c(require,exports,module);}:(c)=>{var m={exports:{}};
|
||||
c(n=>w[n],m.exports,m);w[n]=m.exports;};})('streamService',this));
|
||||
27
assets/webapps/sms.gaiamobile.org/lib/bridge/service.js
Normal file
27
assets/webapps/sms.gaiamobile.org/lib/bridge/service.js
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
var $jscomp={scope:{},global:this},Symbol;$jscomp.initSymbol=function(){$jscomp.global.Symbol||(Symbol=$jscomp.Symbol);$jscomp.initSymbol=function(){}};$jscomp.symbolCounter_=0;$jscomp.Symbol=function(k){return"jscomp_symbol_"+k+$jscomp.symbolCounter_++};$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();Symbol.iterator||(Symbol.iterator=Symbol("iterator"));$jscomp.initSymbolIterator=function(){}};
|
||||
$jscomp.makeIterator=function(k){$jscomp.initSymbolIterator();if(k[Symbol.iterator])return k[Symbol.iterator]();if(!(k instanceof Array||"string"==typeof k||k instanceof String))throw new TypeError(k+" is not iterable");var c=0;return{next:function(){return c==k.length?{done:!0}:{done:!1,value:k[c++]}}}};$jscomp.arrayFromIterator=function(k){for(var c,e=[];!(c=k.next()).done;)e.push(c.value);return e};$jscomp.arrayFromIterable=function(k){return k instanceof Array?k:$jscomp.arrayFromIterator($jscomp.makeIterator(k))};
|
||||
$jscomp.arrayFromArguments=function(k){for(var c=[],e=0;e<k.length;e++)c.push(k[e]);return c};$jscomp.inherits=function(k,c){function e(){}e.prototype=c.prototype;k.prototype=new e;k.prototype.constructor=k;for(var l in c)if($jscomp.global.Object.defineProperties){var a=$jscomp.global.Object.getOwnPropertyDescriptor(c,l);void 0!==a&&$jscomp.global.Object.defineProperty(k,l,a)}else k[l]=c[l]};
|
||||
(function(k){"object"===typeof exports&&"undefined"!==typeof module?module.exports=k():"function"===typeof define&&define.amd?define([],k):("undefined"!==typeof window?window:"undefined"!==typeof global?global:"undefined"!==typeof self?self:this).bridge=k()})(function(){return function c(e,l,a){function m(h,f){if(!l[h]){if(!e[h]){var g="function"==typeof require&&require;if(!f&&g)return g(h,!0);if(p)return p(h,!0);g=Error("Cannot find module '"+h+"'");throw g.code="MODULE_NOT_FOUND",g;}g=l[h]={exports:{}};
|
||||
e[h][0].call(g.exports,function(d){var b=e[h][1][d];return m(b?b:d)},g,g.exports,c,e,l,a)}return l[h].exports}for(var p="function"==typeof require&&require,n=0;n<a.length;n++)m(a[n]);return m}({1:[function(c,e,l){var a=e.exports=self.bridge||{};a.service=c("../src/service");"u"!="undefined"[0]?(void 0)([],function(){return a}):self.bridge=a},{"../src/service":5}],2:[function(c,e,l){function a(c){if(c)return Object.assign(c,a.prototype)}e.exports=a;a.prototype={on:function(a,c){this._callbacks||(this._callbacks=
|
||||
{});this._callbacks[a]||(this._callbacks[a]=[]);this._callbacks[a].push(c);return this},off:function(a,c){if(this._callbacks)switch(arguments.length){case 0:this._callbacks={};break;case 1:delete this._callbacks[a];break;default:var e=this._callbacks[a];if(!e)return;var h=e.indexOf(c);~h&&e.splice(h,1)}return this},emit:function(a,c){if(this._callbacks)for(var e=this._callbacks[a]||[],e=e.concat(this._callbacks["*"]||[]),h=0;h<e.length;h++)e[h].call(this,c,a);return this}};c=a.prototype;c.off=c.off;
|
||||
c.on=c.on},{}],3:[function(c,e,l){function a(b){this.cancelled=!1;this.listeners=[];this.deferred=f();this.listen=this.listen.bind(this);this.onMessage=this.onMessage.bind(this);this.onTimeout=this.onTimeout.bind(this);"object"===typeof b?this.setupInbound(b):this.setupOutbound(b);d("initialized",this.type)}function m(b){this.name=b;this.ports=new Set;this.onMessage=this.onMessage.bind(this);this.listen=this.listen.bind(this);this.unlisten=this.unlisten.bind(this);d("receiver initialized",b)}function p(b,
|
||||
d){for(var a=1;a<arguments.length;++a);return Error({1:".send() can only be called once",2:"response already sent for this message",3:"a port must be defined",4:"timeout"}[b])}var n=c("./port-adaptors"),h=c("../emitter");c=c("../utils");var f=c.deferred,g=c.uuid;l=e.exports=function(b){return new a(b)};l.receiver=function(b,d){return new m(b,d)};l.Receiver=m;l.Message=a;var d={0:function(){},1:function(b){return performance.mark("["+self.constructor.name+"][Message] - "+b)},2:function(b,d){for(var a=
|
||||
[],f=1;f<arguments.length;++f)a[f-1]=arguments[f];console.log.apply(console,[].concat(["[Message]"+("["+self.constructor.name+"]["+location.pathname+"]")+' - "'+b+'"'],$jscomp.arrayFromIterable(a)))}}[0];a.prototype={setupOutbound:function(b){this.id=g();this.type=b;this.sent=!1;this.recipient="*"},setupInbound:function(b){d("inbound");this.hasResponded=!1;this.setSourcePort(b.source||b.target);this.event=b;Object.assign(this,b.data)},setSourcePort:function(b){d("set source",b.constructor.name);this.sourcePort=
|
||||
n(b,{ready:!0});return this},set:function(b,a){d("set",b,a);"object"==typeof b?Object.assign(this,b):this[b]=a;return this},serialize:function(){return{id:this.id,type:this.type,data:this.data,recipient:this.recipient,noRespond:this.noRespond}},preventDefault:function(){d("prevent default");this.defaultPrevented=!0},send:function(b){d("send",this.type);if(this.sent)throw p(1);var a=this.serialize(),f=!this.noRespond;this.port=b?n(b):this.port;if(!this.port)throw p(3);f?(this.listen(this.port),this.setResponseTimeout()):
|
||||
this.deferred.resolve();this.port.postMessage(a,this.getTransfer());d("sent",a);return this.deferred.promise},setResponseTimeout:function(){!1!==this.timeout&&(this._timer=setTimeout(this.onTimeout,this.timeout||2E3))},clearResponseTimeout:function(){clearTimeout(this._timer)},getTransfer:function(){return this.transfer||this.event&&this.event.ports},onMessage:function(b){if(b.data.response&&b.data.id===this.id&&!this.cancelled)this.onResponse(b)},onTimeout:function(){d("response timeout",this.type);
|
||||
this.silentTimeout||this.deferred.reject(p(4));this.teardown()},listen:function(b){d("add response listener",b);b=n(b);b.addListener(this.onMessage,this.listen);this.listeners.push(b);return this},unlisten:function(){var b=this;d("remove response listeners");this.listeners.forEach(function(d){return d.removeListener(b.onMessage)});this.listeners=[]},cancel:function(){this.teardown();this.cancelled=!0;this.emit("cancel")},teardown:function(){this.clearResponseTimeout();this.unlisten()},respond:function(b){function a(b){d("resolve",
|
||||
b);c({type:"resolve",value:b})}function f(b){a:switch(b&&b.constructor.name){case "DOMException":case "Error":b={message:b.message};break a;case "DOMError":b={message:b.message,name:b.name};break a}d("reject",b);c({type:"reject",value:b})}function c(b){g.response=b;g.sourcePort.postMessage({id:g.id,response:b},g.transfer);d("responded with:",b)}d("respond",b,this.id);if(this.hasResponded)throw p(2);if(this.sourcePort&&!this.noRespond){this.hasResponded=!0;var g=this;this.error&&f(this.error);Promise.resolve(b).then(a,
|
||||
f).catch(f)}},forward:function(b){var a=this;d("forward");return this.set("silentTimeout",!0).send(b).then(function(b){return a.respond(b.value)})},onResponse:function(b){d("on response",b.data);var a=b.data.response,f="reject"==a.type?a.value:a;a.event=b;this.response=a;this.teardown();this.deferred[this.response.type](f);this.emit("response",a)}};h(a.prototype);m.prototype={listen:function(b){d("listen");b=n(b||self,{receiver:!0});if(!this.ports.has(b))return b.addListener(this.onMessage,this.listen),
|
||||
this.ports.add(b),this},unlisten:function(){var b=this;d("unlisten");this.ports.forEach(function(d){return d.removeListener(b.onMessage)})},onMessage:function(b){if(b.data.id&&b.data.type&&this.isRecipient(b.data.recipient)&&(d("receiver on message",b.data),b=new a(b),this.emit("message",b),!b.defaultPrevented))try{this.emit(b.type,b)}catch(f){throw b.error=f,b.respond(),f;}},isRecipient:function(b){return b==this.name||"*"==b||"*"==this.name},destroy:function(){this.unlisten();delete this.name;return this}};
|
||||
h(m.prototype)},{"../emitter":2,"../utils":6,"./port-adaptors":4}],4:[function(c,e,l){function a(d){this.target=d}function m(d,b,a){d.addEventListener(b,a)}function p(d,b,a){b={data:b,source:self};a&&(b.ports=a);d.dispatchEvent(new MessageEvent("message",b))}var n=c("../utils").deferred;e.exports=function(d,b){if(!d)throw Error({1:"target is undefined"}[1]);if(d&&d.addListener)return d;var g=f[d.constructor.name];return g?g(d,b):new a(d,b)};var h=a.prototype={constructor:a,addListener:function(d){this.target.addEventListener("message",
|
||||
d)},removeListener:function(d){this.target.removeEventListener("message",d)},postMessage:function(d,b){this.target.postMessage(d,b)}},f={HTMLIFrameElement:function(d){var b=g(d);return{addListener:function(b){window.addEventListener("message",b)},removeListener:function(b){window.removeEventListener("message",b)},postMessage:function(a,f){b.then(function(){return p(d.contentWindow,a,f)})}}},BroadcastChannel:function(a,b){function f(){var b=n();a.postMessage("ready?");m(a,"message",function q(f){"ready"==
|
||||
f.data&&(a.removeEventListener("message",q),b.resolve())});return b.promise}var g=b&&b.receiver,c=b&&b.ready,c=c||g?Promise.resolve():f();g&&(a.postMessage("ready"),m(a,"message",function(b){"ready?"==b.data&&a.postMessage("ready")}));return{target:a,addListener:h.addListener,removeListener:h.removeListener,postMessage:function(b,f){c.then(function(){return a.postMessage(b,f)})}}},Window:function(a,b){var f=b&&b.ready||a===parent||a===self,f=f?Promise.resolve():g(a);return{addListener:function(b){window.addEventListener("message",
|
||||
b)},removeListener:function(b){window.removeEventListener("message",b)},postMessage:function(b,g){f.then(function(){return p(a,b,g)})}}},SharedWorker:function(f){f.port.start();return new a(f.port)},SharedWorkerGlobalScope:function(){var a=[];return{postMessage:function(){},addListener:function(b,f){this.onconnect=function(b){b=b.ports[0];a.push(b);b.start();f(b)};self.addEventListener("connect",this.onconnect)},removeListener:function(b){self.removeEventListener("connect",this.onconnect);a.forEach(function(a){a.close();
|
||||
a.removeEventListener("message",b)})}}}},g=function(){if("undefined"!=typeof window){var a=window.opener||window.parent,b=new WeakSet;a!=self&&m(window,"DOMContentLoaded",function r(){window.removeEventListener("DOMContentLoaded",r);p(a,"load")});m(self,"message",function(a){return"load"==a.data&&b.add(a.source)});return function(a){var f=a.contentWindow||a;if(b.has(f)||f==window.parent)return Promise.resolve();var d=n();m(window,"message",function q(b){"load"==b.data&&b.source==f&&(window.removeEventListener("message",
|
||||
q),d.resolve())});return d.promise}}}()},{"../utils":6}],5:[function(c,e,l){function a(f){if(!(this instanceof a))return new a(f);n.Receiver.call(this,f);this.clients={};this.methods={};this.on("_disconnect",this.onDisconnect.bind(this)).on("_connect",this.onConnect.bind(this)).on("_method",this.onMethod.bind(this)).on("_off",this.onOff.bind(this)).on("_on",this.onOn.bind(this));this.destroy=this.destroy.bind(this);h("initialized",f)}function m(a){var g=[].slice.call(arguments,1);return Error({4:'method "'+
|
||||
g[0]+"\" doesn't exist"}[a])}var p=c("./utils").uuid,n=c("./message");c=n.Receiver;e.exports=a;var h={0:function(){},1:function(a){return performance.mark("["+self.constructor.name+"][Service] - "+a)},2:function(a,g){for(var d=[],b=1;b<arguments.length;++b)d[b-1]=arguments[b];console.log.apply(console,[].concat(["[Service]"+("["+self.constructor.name+"]["+location.pathname+"]")+' - "'+a+'"'],$jscomp.arrayFromIterable(d)))}}[0];a.prototype=Object.create(c.prototype);a.prototype.inWindow="Window"===
|
||||
constructor.name;a.prototype.method=function(a,g){this.methods[a]=g;return this};a.prototype.broadcast=function(a,g,d){var b=this;h("broadcast",a,g,d);this.eachClient(function(c){if(!d||~d.indexOf(c.id))h("broadcasting to",c.id),b.push(a,g,c.id,{noRespond:!0})});return this};a.prototype.push=function(a,g,d,b){b=b&&b.noRespond;var c=this.getClient(d);return n("_push").set({recipient:d,noRespond:b,data:{type:a,data:g}}).send(c.port)};a.prototype.eachClient=function(a){for(var c in this.clients)a(this.clients[c])};
|
||||
a.prototype.getClient=function(a){return this.clients[a]};a.prototype.onConnect=function(a){h("connection attempt",a.data,this.name);var c=a.data,d=c.clientId;d&&c.service===this.name&&!this.clients[d]&&(this.emit("before-connect",a),a.defaultPrevented||(this.upgradeChannel(a),this.addClient(d,a.sourcePort),a.respond(),this.emit("connected",d),h("connected",d)))};a.prototype.upgradeChannel=function(a){if(!this.inWindow||"Window"!==a.data.originEnv){var c=a.event.ports;if(c=c&&c[0])a.setSourcePort(c),
|
||||
this.listen(c),c.start();h("channel upgraded")}};a.prototype.onDisconnect=function(a){var c=this.clients[a.data];c&&(this.emit("before-disconnect",a),a.defaultPrevented||(this.removeClient(c.id),a.respond(),this.emit("disconnected",c.id),h("disconnected",c.id)))};a.prototype.onMethod=function(a){h("on method",a.data);this.emit("before-method",a);if(!a.defaultPrevented){var c=a.data,d=c.name,b=this.methods[d],e;if(!b)throw m(4,d);try{e=b.apply(this,c.args)}catch(l){a.error=l}a.respond(e)}};a.prototype.onOn=
|
||||
function(a){h("on on",a.data);this.emit("on",a.data)};a.prototype.onOff=function(a){h("on off");this.emit("off",a.data)};a.prototype.addClient=function(a,c){this.clients[a]={id:a,port:c}};a.prototype.removeClient=function(a){delete this.clients[a]};a.prototype.plugin=function(a){a(this,{uuid:p});return this};a.prototype.disconnect=function(a){this.removeClient(a.id);n("disconnect").set({recipient:a.id,noRespond:!0}).send(a.port)};a.prototype.destroy=function(){delete this.clients;this.unlisten();
|
||||
this.off()};e=a.prototype;e.broadcast=e.broadcast;e.destroy=e.destroy;e.method=e.method;e.plugin=e.plugin},{"./message":3,"./utils":6}],6:[function(c,e,l){l.uuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var c=16*Math.random()|0;return("x"==a?c:c&3|8).toString(16)})};l.deferred=function(){var a={};a.promise=new Promise(function(c,e){a.resolve=c;a.reject=e});return a}},{}]},{},[1])(1)});
|
||||
Loading…
Reference in a new issue