Git Product home page Git Product logo

ngchromestorage's Introduction

ngChromeStorage

An AngularJS module for chrome.storage, Contains two services $chromeStoreSync and $chromeStoreLocal which give access to chrome.storage.sync and chrome.storage.local respectively. ###Features

  • Two-way binding no need to use getters and setters, storage objects appear as plain old JavaScript objects.

Install

bower :

bower install ngChromeStorage

Usage

angular.module('app', [
    'ngChromeStorage'
]).controller('Ctrl', function(
    $scope,
    $chromeStoreSync,
    $chromeStoreLocal
){});

Read and Write

Pass $chromeStoreSync and/or$chromeStoreLocal and attach to scope

$scope.$store = $chromeStoreSync

Use it like a normal javascript object.

<body ng-controller="Ctrl">
	<button ng-click="$store.counter = $store.counter + 1">{{$store.counter}}</button>
</body>

here any changes made to $scope.$store , $chromeStoreSync andchrome.storage.sync will automatically be synced this includes changes detected by chrome.storage.onChanged

Note

  • Internally changes are detected by using $rootScope.$watch so be aware of the potential proformance issues.
  • chrome.storage is an asynchronous API, and ngChromeStorage gives it a seemingly synchronous interface.
  • chrome.storage.sync has limitations that you must be mindful of, with ngChromeStorage it is easy to exceed these limits.
    • MAX_WRITE_OPERATIONS_PER_MINUTE 120
    • MAX_WRITE_OPERATIONS_PER_HOUR 1,800
    • QUOTA_BYTES_PER_ITEM 8,192

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.