The fortune-cookie
element can be used to set and read cookies.
You should have one fortune-cookie
element per cookie you want to use, defined in many elements by its name
property.
You can then read the value
of the cookie, or save the cookie by setting the value
attribute or explicitly calling the save
method.
Example
<fortune-cookie
name="mycookie"
value="{{object}}"
on-handle-value-as="Object"
on-fortune-cookie-expired="_onExpired"
on-fortune-cookie-load-empty="_onLoadEmpty">
</fortune-cookie>
Save:
this.$.mycookie.save();
Realod:
this.$.mycookie.load();