Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Hub
- // Config s.t. subdomains can get, but only the root domain can set and del
- CrossStorageHub.init([
- {origin: /.example.com$/, allow: ['get']},
- {origin: /://(www.)?example.com$/, allow: ['get', 'set', 'del']}
- ]);
- Client
- var storage = new CrossStorageClient('https://store.example.com/hub.html');
- storage.onConnect().then(function() {
- return storage.set('newKey', 'foobar');
- }).then(function() {
- return storage.get('existingKey', 'newKey');
- }).then(function(res) {
- console.log(res.length); // 2
- }).catch(function(err) {
- // Handle error
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement