-
Notifications
You must be signed in to change notification settings - Fork 180
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
30afdb8
commit fbf662a
Showing
8 changed files
with
43 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/** | ||
* cross-storage - Cross domain local storage | ||
* | ||
* @version 0.4.1 | ||
* @version 0.5.0 | ||
* @link https://github.com/zendesk/cross-storage | ||
* @author Daniel St. Jules <[email protected]> | ||
* @copyright Zendesk | ||
|
@@ -207,8 +207,14 @@ CrossStorageClient.prototype.del = function() { | |
return this._request('del', {keys: args}); | ||
}; | ||
|
||
CrossStorageClient.prototype.clear = function (params) { | ||
return this._request('clear', params); | ||
/** | ||
* Returns a promise that, when resolved, indicates that all localStorage | ||
* data has been cleared. | ||
* | ||
* @returns {Promise} A promise that is settled on hub response or timeout | ||
*/ | ||
CrossStorageClient.prototype.clear = function() { | ||
return this._request('clear'); | ||
}; | ||
|
||
/** | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/** | ||
* cross-storage - Cross domain local storage | ||
* | ||
* @version 0.4.1 | ||
* @version 0.5.0 | ||
* @link https://github.com/zendesk/cross-storage | ||
* @author Daniel St. Jules <[email protected]> | ||
* @copyright Zendesk | ||
|
@@ -15,8 +15,8 @@ var CrossStorageHub = {}; | |
* of origin is expected to be a RegExp, and allow, an array of strings. | ||
* The cross storage hub is then initialized to accept requests from any of | ||
* the matching origins, allowing access to the associated lists of methods. | ||
* Methods may include any of: get, set, del, and getKeys. A 'ready' message | ||
* is sent to the parent window once complete. | ||
* Methods may include any of: get, set, del, getKeys and clear. A 'ready' | ||
* message is sent to the parent window once complete. | ||
* | ||
* @example | ||
* // Subdomain can get, but only root domain can set and del | ||
|
@@ -39,7 +39,11 @@ CrossStorageHub.init = function(permissions) { | |
} | ||
|
||
if (!available) { | ||
return window.parent.postMessage('unavailable', '*'); | ||
try { | ||
return window.parent.postMessage('unavailable', '*'); | ||
} catch (e) { | ||
return; | ||
} | ||
} | ||
|
||
CrossStorageHub._permissions = permissions || []; | ||
|
@@ -199,9 +203,9 @@ CrossStorageHub._del = function(params) { | |
}; | ||
|
||
/** | ||
* Clears the local storage | ||
* Clears localStorage. | ||
*/ | ||
CrossStorageHub._clear = function () { | ||
CrossStorageHub._clear = function() { | ||
window.localStorage.clear(); | ||
}; | ||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters