Skip to content

Commit d562ceb

Browse files
committed
1.0.0
1 parent 31baa28 commit d562ceb

File tree

8 files changed

+27
-48
lines changed

8 files changed

+27
-48
lines changed

.zuul.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ browsers:
1818
version: latest
1919
platform: Linux
2020
- name: safari
21-
version: 5..7
21+
version: 7
2222
- name: ie
2323
version: 8..latest
2424
- name: android

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,11 @@ storage.onConnect().then(function() {
270270
});
271271
```
272272

273+
**Breaking Changes**
274+
275+
API breaking changes were introduced in both 0.6 and 1.0. Refer to
276+
[releases](https://github.com/zendesk/cross-storage/releases) for details.
277+
273278
**Notes on Safari 7+ (OSX, iOS)**
274279

275280
All cross-domain local storage access is disabled by default with Safari 7+.

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cross-storage",
3-
"version": "0.8.2",
3+
"version": "1.0.0",
44
"description": "Cross domain local storage",
55
"license": "Apache-2.0",
66
"authors": [

dist/client.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* cross-storage - Cross domain local storage
33
*
4-
* @version 0.8.2
4+
* @version 1.0.0
55
* @link https://github.com/zendesk/cross-storage
66
* @author Daniel St. Jules <[email protected]>
77
* @copyright Zendesk
@@ -172,21 +172,18 @@
172172
};
173173

174174
/**
175-
* Sets a key to the specified value, optionally accepting a ttl to passively
176-
* expire the key after a number of milliseconds. Returns a promise that is
177-
* fulfilled on success, or rejected if any errors setting the key occurred,
178-
* or the request timed out.
175+
* Sets a key to the specified value. Returns a promise that is fulfilled on
176+
* success, or rejected if any errors setting the key occurred, or the request
177+
* timed out.
179178
*
180179
* @param {string} key The key to set
181180
* @param {*} value The value to assign
182-
* @param {int} ttl Time to live in milliseconds
183181
* @returns {Promise} A promise that is settled on hub response or timeout
184182
*/
185-
CrossStorageClient.prototype.set = function(key, value, ttl) {
183+
CrossStorageClient.prototype.set = function(key, value) {
186184
return this._request('set', {
187185
key: key,
188-
value: value,
189-
ttl: ttl
186+
value: value
190187
});
191188
};
192189

dist/client.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/hub.js

Lines changed: 9 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* cross-storage - Cross domain local storage
33
*
4-
* @version 0.8.2
4+
* @version 1.0.0
55
* @link https://github.com/zendesk/cross-storage
66
* @author Daniel St. Jules <[email protected]>
77
* @copyright Zendesk
@@ -160,59 +160,36 @@
160160
};
161161

162162
/**
163-
* Sets a key to the specified value. If a ttl is provided, an expiration
164-
* timestamp is added to the object to be stored, prior to serialization.
163+
* Sets a key to the specified value.
165164
*
166-
* @param {object} params An object with key, value and optional ttl
165+
* @param {object} params An object with key and value
167166
*/
168167
CrossStorageHub._set = function(params) {
169-
var ttl, item;
170-
171-
ttl = params.ttl;
172-
if (ttl && parseInt(ttl, 10) !== ttl) {
173-
throw new Error('ttl must be a number');
174-
}
175-
176-
item = {value: params.value};
177-
if (ttl) {
178-
item.expire = CrossStorageHub._now() + ttl;
179-
}
180-
181-
window.localStorage.setItem(params.key, JSON.stringify(item));
168+
window.localStorage.setItem(params.key, params.value);
182169
};
183170

184171
/**
185172
* Accepts an object with an array of keys for which to retrieve their values.
186173
* Returns a single value if only one key was supplied, otherwise it returns
187-
* an array. Any keys not set, or expired, result in a null element in the
188-
* resulting array.
174+
* an array. Any keys not set result in a null element in the resulting array.
189175
*
190176
* @param {object} params An object with an array of keys
191177
* @returns {*|*[]} Either a single value, or an array
192178
*/
193179
CrossStorageHub._get = function(params) {
194-
var storage, result, i, item, key;
180+
var storage, result, i, value;
195181

196182
storage = window.localStorage;
197183
result = [];
198184

199185
for (i = 0; i < params.keys.length; i++) {
200-
key = params.keys[i];
201-
202186
try {
203-
item = JSON.parse(storage.getItem(key));
187+
value = storage.getItem(params.keys[i]);
204188
} catch (e) {
205-
item = null;
189+
value = null;
206190
}
207191

208-
if (item === null) {
209-
result.push(null);
210-
} else if (item.expire && item.expire < CrossStorageHub._now()) {
211-
storage.removeItem(key);
212-
result.push(null);
213-
} else {
214-
result.push(item.value);
215-
}
192+
result.push(value);
216193
}
217194

218195
return (result.length > 1) ? result : result[0];

dist/hub.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cross-storage",
3-
"version": "0.8.2",
3+
"version": "1.0.0",
44
"description": "Cross domain local storage",
55
"keywords": [
66
"local",

0 commit comments

Comments
 (0)