Memory

Handles local data storage, with cookies as fallback. You don't have to worry with browser compatibility. Just ask the memory to remember something for you and it will choose the best available option.



__.memory.set( name: string, data: object, timing: number, period: string )

Record data on localStorage or cookies. You can set any kind of object as data. By default, localStorage doesn't have an expiration date, but here we got you covered. We treat localStorage data just like a cookie. Even easier than that, you can literally pass when you want this memory to forgot it. Like, in 7 days, or in 2 years.

__.memory.set('batman', 'hero', 7, 'days');

__.memory.get( name: string )

Get data from localStorage or cookies.

__.memory.get('batman');    // Returns "hero".

__.memory.delete( name: string )

Removes data from localStorage or cookies.

__.memory.delete('batman'); // Goodbye, Bruce.

Based on Keep module from our previous library.