Adding rs.js to an app

rs.js is distributed as a single UMD build, which means it should work with all known JavaScript module systems, as well as without one (using a global variable).

We recommend adding the library from a JavaScript package manager, although you may also just download the release build from GitHub.

The package is available on npm as remotestoragejs:

$ npm install remotestoragejs


ES6 module

import RemoteStorage from 'remotestoragejs';

CommonJS module

var RemoteStorage = require('remotestoragejs');

AMD module

For example with RequireJS:

  paths: {
    RemoteStorage: './lib/remotestorage'

requirejs(['RemoteStorage'], function(RemoteStorage) {
  // Here goes my app

No module system

If you just link the build from HTML, it will add RemoteStorage as a global variable to window.

<script type="text/javascript" src="remotestorage.js"></script>


ES6 modules from npm should be supported natively soon, but for now you can use Browserify via ember-browserify, enabling you to import the module from npm like this:

import RemoteStorage from 'npm:remotestoragejs';

Caveat emptor (no promises)

Please be aware of the fact that although rs.js is generally compatible with older browsers as well as the latest ones, we do not include a polyfill for JavaScript Promises anymore.

This means that, if you do not add your own polyfill, and no other library in your build comes with one, rs.js will break in browsers, which do not support Promises. A detailed overview of supported browsers is available on Notable examples would be Android up to 4.4 and Internet Explorer up to 11.

You can find a list of polyfill libraries on the Promises website. A good choice for a small and simple polyfill would be es6-promise-auto for example.