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
gaia/apps/system/test/unit/mock_asyncStorage.js
Executable file
42
gaia/apps/system/test/unit/mock_asyncStorage.js
Executable file
|
|
@ -0,0 +1,42 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
'use strict';
|
||||
|
||||
/* exported MockasyncStorage */
|
||||
|
||||
var MockasyncStorage = {
|
||||
mItems: {},
|
||||
|
||||
setItem: function(key, value, callback) {
|
||||
this.mItems[key] = value;
|
||||
if (typeof callback === 'function') {
|
||||
callback();
|
||||
}
|
||||
},
|
||||
|
||||
getItem: function(key, callback) {
|
||||
var value = this.mItems[key];
|
||||
// use '|| null' will turn a 'false' to null
|
||||
if (value === undefined) {
|
||||
value = null;
|
||||
}
|
||||
if (typeof callback === 'function') {
|
||||
callback(value);
|
||||
}
|
||||
},
|
||||
|
||||
removeItem: function(key, callback) {
|
||||
if (key in this.mItems) {
|
||||
delete this.mItems[key];
|
||||
}
|
||||
|
||||
if (typeof callback === 'function') {
|
||||
callback();
|
||||
}
|
||||
},
|
||||
|
||||
mTeardown: function() {
|
||||
this.mItems = {};
|
||||
}
|
||||
};
|
||||
Loading…
Reference in a new issue