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
42
assets/webapps/system.gaiamobile.org/js/import.js
Normal file
42
assets/webapps/system.gaiamobile.org/js/import.js
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
'use strict';
|
||||
(function(exports) {
|
||||
|
||||
/**
|
||||
* Handles importing of blobs into the system app.
|
||||
* Currently supports the 'import-app' activity, which
|
||||
* installs a blob on the device if developer mode is enabled.
|
||||
*/
|
||||
function Import() {}
|
||||
|
||||
Import.prototype = {
|
||||
|
||||
/**
|
||||
* Starts listening to activities.
|
||||
*/
|
||||
start: function() {
|
||||
window.addEventListener('activity-import-app',
|
||||
this.handleActivity.bind(this));
|
||||
},
|
||||
|
||||
/**
|
||||
* Imports an application into the system.
|
||||
*/
|
||||
handleActivity: function(e) {
|
||||
var blob = e.detail.source.data.blob;
|
||||
navigator.mozApps.mgmt.import(blob)
|
||||
.then((addon) => {
|
||||
// Enable the addon by default.
|
||||
navigator.mozApps.mgmt.setEnabled(addon, true);
|
||||
e.detail.postResult({
|
||||
manifestURL: addon.manifestURL
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
e.detail.postError(error);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
exports.Import = Import;
|
||||
|
||||
}(window));
|
||||
Loading…
Reference in a new issue