Skip to content

Commit fbf662a

Browse files
committed
0.5.0
1 parent 30afdb8 commit fbf662a

8 files changed

+43
-33
lines changed

bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cross-storage",
3-
"version": "0.4.0",
3+
"version": "0.5.0",
44
"description": "Cross domain local storage",
55
"license": "Apache-2.0",
66
"authors": [

dist/client-0.4.1.min.js

-11
This file was deleted.

dist/client-0.4.1.js renamed to dist/client.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* cross-storage - Cross domain local storage
33
*
4-
* @version 0.4.1
4+
* @version 0.5.0
55
* @link https://github.com/zendesk/cross-storage
66
* @author Daniel St. Jules <danielst.jules@gmail.com>
77
* @copyright Zendesk
@@ -207,8 +207,14 @@ CrossStorageClient.prototype.del = function() {
207207
return this._request('del', {keys: args});
208208
};
209209

210-
CrossStorageClient.prototype.clear = function (params) {
211-
return this._request('clear', params);
210+
/**
211+
* Returns a promise that, when resolved, indicates that all localStorage
212+
* data has been cleared.
213+
*
214+
* @returns {Promise} A promise that is settled on hub response or timeout
215+
*/
216+
CrossStorageClient.prototype.clear = function() {
217+
return this._request('clear');
212218
};
213219

214220
/**

dist/client.min.js

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/hub-0.4.1.min.js

-11
This file was deleted.

dist/hub-0.4.1.js renamed to dist/hub.js

+10-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* cross-storage - Cross domain local storage
33
*
4-
* @version 0.4.1
4+
* @version 0.5.0
55
* @link https://github.com/zendesk/cross-storage
66
* @author Daniel St. Jules <danielst.jules@gmail.com>
77
* @copyright Zendesk
@@ -15,8 +15,8 @@ var CrossStorageHub = {};
1515
* of origin is expected to be a RegExp, and allow, an array of strings.
1616
* The cross storage hub is then initialized to accept requests from any of
1717
* the matching origins, allowing access to the associated lists of methods.
18-
* Methods may include any of: get, set, del, and getKeys. A 'ready' message
19-
* is sent to the parent window once complete.
18+
* Methods may include any of: get, set, del, getKeys and clear. A 'ready'
19+
* message is sent to the parent window once complete.
2020
*
2121
* @example
2222
* // Subdomain can get, but only root domain can set and del
@@ -39,7 +39,11 @@ CrossStorageHub.init = function(permissions) {
3939
}
4040

4141
if (!available) {
42-
return window.parent.postMessage('unavailable', '*');
42+
try {
43+
return window.parent.postMessage('unavailable', '*');
44+
} catch (e) {
45+
return;
46+
}
4347
}
4448

4549
CrossStorageHub._permissions = permissions || [];
@@ -199,9 +203,9 @@ CrossStorageHub._del = function(params) {
199203
};
200204

201205
/**
202-
* Clears the local storage
206+
* Clears localStorage.
203207
*/
204-
CrossStorageHub._clear = function () {
208+
CrossStorageHub._clear = function() {
205209
window.localStorage.clear();
206210
};
207211

dist/hub.min.js

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cross-storage",
3-
"version": "0.4.1",
3+
"version": "0.5.0",
44
"description": "Cross domain local storage",
55
"keywords": [
66
"local",

0 commit comments

Comments
 (0)