Skip to content

Commit

Permalink
💄
Browse files Browse the repository at this point in the history
  • Loading branch information
akiomik committed Oct 23, 2015
1 parent ac7254b commit fe27d5a
Show file tree
Hide file tree
Showing 6 changed files with 239 additions and 237 deletions.
8 changes: 7 additions & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module.exports = function(config) {
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'test/*.js': ['webpack']
'test/*.js': ['webpack']
},


Expand Down Expand Up @@ -65,6 +65,12 @@ module.exports = function(config) {

// webpack settings
webpack: {
module: {
loaders: [{
test: /test\/.+\.js$/,
loader: 'babel-loader',
}]
}
}
});
};
32 changes: 16 additions & 16 deletions src/chrome-storage-promise.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ chrome.storage.promise = {
// sync
sync: {
get: (keys) => {
var promise = new Promise((resolve, reject) => {
let promise = new Promise((resolve, reject) => {
chrome.storage.sync.get(keys, (items) => {
let err = chrome.runtime.lastError;
if (err) {
Expand All @@ -18,7 +18,7 @@ chrome.storage.promise = {
return promise;
},
set: (items) => {
var promise = new Promise((resolve, reject) => {
let promise = new Promise((resolve, reject) => {
chrome.storage.sync.set(items, () => {
let err = chrome.runtime.lastError;
if (err) {
Expand All @@ -31,7 +31,7 @@ chrome.storage.promise = {
return promise;
},
getBytesInUse: (keys) => {
var promise = new Promise((resolve, reject) => {
let promise = new Promise((resolve, reject) => {
chrome.storage.sync.getBytesInUse(keys, (items) => {
let err = chrome.runtime.lastError;
if (err) {
Expand All @@ -44,7 +44,7 @@ chrome.storage.promise = {
return promise;
},
remove: (keys) => {
var promise = new Promise((resolve, reject) => {
let promise = new Promise((resolve, reject) => {
chrome.storage.sync.remove(keys, () => {
let err = chrome.runtime.lastError;
if (err) {
Expand All @@ -57,7 +57,7 @@ chrome.storage.promise = {
return promise;
},
clear: () => {
var promise = new Promise((resolve, reject) => {
let promise = new Promise((resolve, reject) => {
chrome.storage.sync.clear(() => {
let err = chrome.runtime.lastError;
if (err) {
Expand All @@ -74,7 +74,7 @@ chrome.storage.promise = {
// local
local: {
get: (keys) => {
var promise = new Promise((resolve, reject) => {
let promise = new Promise((resolve, reject) => {
chrome.storage.local.get(keys, (items) => {
let err = chrome.runtime.lastError;
if (err) {
Expand All @@ -87,7 +87,7 @@ chrome.storage.promise = {
return promise;
},
set: (items) => {
var promise = new Promise((resolve, reject) => {
let promise = new Promise((resolve, reject) => {
chrome.storage.local.set(items, () => {
let err = chrome.runtime.lastError;
if (err) {
Expand All @@ -100,7 +100,7 @@ chrome.storage.promise = {
return promise;
},
getBytesInUse: (keys) => {
var promise = new Promise((resolve, reject) => {
let promise = new Promise((resolve, reject) => {
chrome.storage.local.getBytesInUse(keys, (items) => {
let err = chrome.runtime.lastError;
if (err) {
Expand All @@ -113,7 +113,7 @@ chrome.storage.promise = {
return promise;
},
remove: (keys) => {
var promise = new Promise((resolve, reject) => {
let promise = new Promise((resolve, reject) => {
chrome.storage.local.remove(keys, () => {
let err = chrome.runtime.lastError;
if (err) {
Expand All @@ -126,7 +126,7 @@ chrome.storage.promise = {
return promise;
},
clear: () => {
var promise = new Promise((resolve, reject) => {
let promise = new Promise((resolve, reject) => {
chrome.storage.local.clear(() => {
let err = chrome.runtime.lastError;
if (err) {
Expand All @@ -143,7 +143,7 @@ chrome.storage.promise = {
// managed
managed: {
get: (keys) => {
var promise = new Promise((resolve, reject) => {
let promise = new Promise((resolve, reject) => {
chrome.storage.managed.get(keys, (items) => {
let err = chrome.runtime.lastError;
if (err) {
Expand All @@ -156,7 +156,7 @@ chrome.storage.promise = {
return promise;
},
set: (items) => {
var promise = new Promise((resolve, reject) => {
let promise = new Promise((resolve, reject) => {
chrome.storage.managed.set(items, () => {
let err = chrome.runtime.lastError;
if (err) {
Expand All @@ -169,7 +169,7 @@ chrome.storage.promise = {
return promise;
},
getBytesInUse: (keys) => {
var promise = new Promise((resolve, reject) => {
let promise = new Promise((resolve, reject) => {
chrome.storage.managed.getBytesInUse(keys, (items) => {
let err = chrome.runtime.lastError;
if (err) {
Expand All @@ -182,7 +182,7 @@ chrome.storage.promise = {
return promise;
},
remove: (keys) => {
var promise = new Promise((resolve, reject) => {
let promise = new Promise((resolve, reject) => {
chrome.storage.managed.remove(keys, () => {
let err = chrome.runtime.lastError;
if (err) {
Expand All @@ -195,7 +195,7 @@ chrome.storage.promise = {
return promise;
},
clear: () => {
var promise = new Promise((resolve, reject) => {
let promise = new Promise((resolve, reject) => {
chrome.storage.managed.clear(() => {
let err = chrome.runtime.lastError;
if (err) {
Expand All @@ -212,7 +212,7 @@ chrome.storage.promise = {
// onChanged
onChanged: {
addListener: () => {
var promise = new Promise((resolve, reject) => {
let promise = new Promise((resolve, reject) => {
chrome.storage.onChanged.addListener((changes, areaName) => {
let err = chrome.runtime.lastError;
if (err) {
Expand Down
64 changes: 32 additions & 32 deletions test/chrome-storage-mock-error.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,107 +2,107 @@

chrome.storage = {
sync: {
get: function(keys, callback) {
setTimeout(function() {
get: (keys, callback) => {
setTimeout(() => {
chrome.runtime.lastError = '42';
callback();
}, 100);
},
set: function(items, callback) {
setTimeout(function() {
set: (items, callback) => {
setTimeout(() => {
chrome.runtime.lastError = '42';
callback();
}, 100);
},
getBytesInUse: function(keys, callback) {
setTimeout(function() {
getBytesInUse: (keys, callback) => {
setTimeout(() => {
chrome.runtime.lastError = '42';
callback();
}, 100);
},
remove: function(items, callback) {
setTimeout(function() {
remove: (items, callback) => {
setTimeout(() => {
chrome.runtime.lastError = '42';
callback();
}, 100);
},
clear: function(callback) {
setTimeout(function() {
clear: (callback) => {
setTimeout(() => {
chrome.runtime.lastError = '42';
callback();
}, 100);
},
},

local: {
get: function(keys, callback) {
setTimeout(function() {
get: (keys, callback) => {
setTimeout(() => {
chrome.runtime.lastError = '42';
callback();
}, 100);
},
set: function(items, callback) {
setTimeout(function() {
set: (items, callback) => {
setTimeout(() => {
chrome.runtime.lastError = '42';
callback();
}, 100);
},
getBytesInUse: function(keys, callback) {
setTimeout(function() {
getBytesInUse: (keys, callback) => {
setTimeout(() => {
chrome.runtime.lastError = '42';
callback();
}, 100);
},
remove: function(items, callback) {
setTimeout(function() {
remove: (items, callback) => {
setTimeout(() => {
chrome.runtime.lastError = '42';
callback();
}, 100);
},
clear: function(callback) {
setTimeout(function() {
clear: (callback) => {
setTimeout(() => {
chrome.runtime.lastError = '42';
callback();
}, 100);
},
},

managed: {
get: function(keys, callback) {
setTimeout(function() {
get: (keys, callback) => {
setTimeout(() => {
chrome.runtime.lastError = '42';
callback();
}, 100);
},
set: function(items, callback) {
setTimeout(function() {
set: (items, callback) => {
setTimeout(() => {
chrome.runtime.lastError = '42';
callback();
}, 100);
},
getBytesInUse: function(keys, callback) {
setTimeout(function() {
getBytesInUse: (keys, callback) => {
setTimeout(() => {
chrome.runtime.lastError = '42';
callback();
}, 100);
},
remove: function(items, callback) {
setTimeout(function() {
remove: (items, callback) => {
setTimeout(() => {
chrome.runtime.lastError = '42';
callback();
}, 100);
},
clear: function(callback) {
setTimeout(function() {
clear: (callback) => {
setTimeout(() => {
chrome.runtime.lastError = '42';
callback();
}, 100);
},
},

onChanged: {
addListener: function(callback) {
setTimeout(function() {
addListener: (callback) => {
setTimeout(() => {
chrome.runtime.lastError = '42';
callback();
}, 100);
Expand Down
Loading

0 comments on commit fe27d5a

Please sign in to comment.