You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Removed defaults in favor of a builder: now to supply an api instance with particular predefined (cookie) attributes there's Cookies.withAttributes(), e.g.:
constapi=Cookies.withAttributes({path: '/',secure: true})api.set('key','value')// writes cookie with path: '/' and secure: true...
The attributes that an api instance is configured with are exposed as attributes property; it's an immutable object and unlike defaults cannot be changed to configure the api.
The mechanism to fall back to the standard, internal converter by returning a falsy value in a custom read converter has been removed. Instead the default converters are now exposed as Cookies.converter, which allows for implementing self-contained custom converters providing the same behavior:
withConverter() no longer accepts a function as argument to be turned into a read converter. It is now required to always pass an object with the explicit type(s) of converter(s):
The converter(s) that an api instance is configured with are exposed as converter property; it's an immutable object and cannot be changed to configure the api.
Started providing library as ES module, in addition to UMD module. The module field in package.json points to an ES module variant of the library.
Started using browser field instead of main in package.json (for the UMD variant of the library).
Dropped support for IE < 10.
Removed getJSON(): use Cookies.set('foo', JSON.stringify({ ... })) and JSON.parse(Cookies.get('foo')) instead.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
defaults
in favor of a builder: now to supply an api instance with particular predefined (cookie) attributes there'sCookies.withAttributes()
, e.g.:attributes
property; it's an immutable object and unlikedefaults
cannot be changed to configure the api.Cookies.converter
, which allows for implementing self-contained custom converters providing the same behavior:withConverter()
no longer accepts a function as argument to be turned into a read converter. It is now required to always pass an object with the explicit type(s) of converter(s):converter
property; it's an immutable object and cannot be changed to configure the api.module
field inpackage.json
points to an ES module variant of the library.browser
field instead ofmain
inpackage.json
(for the UMD variant of the library).getJSON()
: useCookies.set('foo', JSON.stringify({ ... }))
andJSON.parse(Cookies.get('foo'))
instead.This discussion was created from the release v3.0.0.
Beta Was this translation helpful? Give feedback.
All reactions