Coder Social home page Coder Social logo

chrome-storage-promise's Introduction

chrome-storage-promise

npm version Bower version Dependency Status Build Status

Installation

npm

npm install --save chrome-storage-promise

bower

bower install --save chrome-storage-promise

Usage

// set
chrome.storage.promise.local.set({'foo': 'bar'}).then(function() {
  // resolved
  console.log('set');
}, function(error) {
  // rejected
  console.log(error);
});

// get
chrome.storage.promise.local.get('foo').then(function(items) {
  // resolved
  console.log(items); // => {'foo': 'bar'}
}, function(error) {
  // rejected
  console.log(error);
});

Development

Build

npm install
npm run build

Test

npm install
npm run build
npm test

Lisence

The MIT License.

chrome-storage-promise's People

Contributors

akiomik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

chrome-storage-promise's Issues

Call promise.reject when chrome.runtime.lastError is set

It would be nice if the promises call the reject function if chrome.runtime.lastError is set.
This way would be easier to handle errors when using the API.
i.e.:

chrome.storage.sync.get(keys, (items) => {
    if(chrome.runtime.lastError) reject();
    else resolve(items);
});

Help me to run tests

I'm trying to run tests, but seems karma runs webpack without babel (without using webpack.conf.js):

> [email protected] test /home/user/chrome-storage-promise
> karma start

Hash: 8344a6c0a9b3c44a5636
Version: webpack 1.9.13
Time: 11ms
webpack: Compiled successfully.
webpack: Compiling...
Hash: 8344a6c0a9b3c44a5636
Version: webpack 1.9.13
Time: 32ms

ERROR in ./test/spec.js
Module parse failed: /home/user/chrome-storage-promise/test/spec.js Line 3: Unexpected reserved word
You may need an appropriate loader to handle this file type.
| 'use strict';
|
| import {unrequireAll} from './spec-helper'
|
| describe('chrome-storage-promise', () => {
webpack: Failed to compile.

Node: 7.7.3

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.