UNPKG

pubnub

Version:

Publish & Subscribe Real-time Messaging with PubNub

22 lines (20 loc) 459 B
/* @flow */ /* global localStorage */ export default { get(key: string) { // try catch for operating within iframes which disable localStorage try { return localStorage.getItem(key); } catch (e) { return null; } }, set(key: string, data: any) { // try catch for operating within iframes which disable localStorage try { return localStorage.setItem(key, data); } catch (e) { return null; } } };