A simple built-in cookie utility that allows setting and getting cookies without the need of specifiyng domains or paths.
Cookie path and domain are automatically set from window.gotoAndPlay.cookieDomain
and window.gotoAndPlay.cookiePath
globals.
Set a simple cookie:
import Cookie from '@cookie';
const name = 'cookie';
const value = 'value';
Cookie.set(name, value);
Set a cookie with custom expiration:
import Cookie from '@cookie';
const name = 'cookie';
const value = 'value';
const expireHours = 24;
Cookie.set(name, value, expireHours);
Get a cookie value:
import Cookie from '@cookie';
const name = 'cookie';
const value = Cookie.get(name);