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
56
gaia/tests/jsmarionette/plugins/marionette-settings-api/index.js
Executable file
56
gaia/tests/jsmarionette/plugins/marionette-settings-api/index.js
Executable file
|
|
@ -0,0 +1,56 @@
|
|||
'use strict';
|
||||
var fs = require('fs');
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {Marionette.Client} client Marionette client to use.
|
||||
*/
|
||||
function SettingsApi(client) {
|
||||
this._client = client;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a setting
|
||||
*
|
||||
* @param {String} name of the setting.
|
||||
* @return {String} value of the setting.
|
||||
*/
|
||||
SettingsApi.prototype.get = function(name) {
|
||||
var script = fs.readFileSync(
|
||||
__dirname + '/lib/scripts/getsetting.js',
|
||||
'utf8'
|
||||
);
|
||||
|
||||
var result = this._client.executeAsyncScript(script, [name]);
|
||||
|
||||
if (result.error) {
|
||||
throw new Error(result.error);
|
||||
}
|
||||
|
||||
return result.value;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set a setting
|
||||
*
|
||||
* @param {String} name of the setting.
|
||||
* @param {String} value of the setting.
|
||||
*/
|
||||
SettingsApi.prototype.set = function(name, value) {
|
||||
var script = fs.readFileSync(
|
||||
__dirname + '/lib/scripts/setsetting.js',
|
||||
'utf8'
|
||||
);
|
||||
|
||||
var result = this._client.executeAsyncScript(script, [name, value]);
|
||||
|
||||
if (result.error) {
|
||||
throw new Error(result.error);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
module.exports = function(client) {
|
||||
return new SettingsApi(client);
|
||||
};
|
||||
Loading…
Reference in a new issue