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
37
assets/webapps/system.gaiamobile.org/js/activity_handler.js
Normal file
37
assets/webapps/system.gaiamobile.org/js/activity_handler.js
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
/* global LazyLoader, Import */
|
||||
'use strict';
|
||||
|
||||
(function(exports) {
|
||||
|
||||
/**
|
||||
* A global activity handler which dispatches mozSetMessageHandler events.
|
||||
*/
|
||||
function ActivityHandler() {}
|
||||
|
||||
ActivityHandler.prototype = {
|
||||
/**
|
||||
* Starts listening for activities.
|
||||
*/
|
||||
start: function() {
|
||||
window.navigator.mozSetMessageHandler('activity',
|
||||
this.handleActivity.bind(this));
|
||||
return LazyLoader.load(['js/import.js']).then(() => {
|
||||
this.import = new Import();
|
||||
return Promise.resolve(this.import.start());
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Handles activity requests.
|
||||
*/
|
||||
handleActivity: function(activity) {
|
||||
var name = activity.source.name;
|
||||
window.dispatchEvent(new CustomEvent('activity-' + name, {
|
||||
detail: activity
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
exports.ActivityHandler = ActivityHandler;
|
||||
|
||||
}(window));
|
||||
Loading…
Reference in a new issue