Page MenuHomeGitPull.it

class JX.Cookie
Javelin Documentation ()

This class is not documented.

Tasks

Builtin Events

  • invoke(type, more) — Invoke a class event, notifying all listeners. You must declare the events your class invokes when you install it; see @{function:JX.install} for documentation. Any arguments you provide will be passed to listener callbacks.
  • static listen(type, callback) — Static listen interface for listening to events produced by any instance of this class. See @{method:listen} for documentation.

Other Methods

  • construct(key) — Setting cookies involves setting up a cookie object which is eventually written.
  • dispose()

Methods

invoke(type, more)
Inherited

JX.Base

Invoke a class event, notifying all listeners. You must declare the events your class invokes when you install it; see JX.install() for documentation. Any arguments you provide will be passed to listener callbacks.

Parameters
stringtypeEvent type, must be declared when class is installed.
...moreZero or more arguments.
Return
JX.EventEvent object which was dispatched.

static listen(type, callback)
Inherited

JX.Base

Listen for events emitted by this object instance. You can also use the static flavor of this method to listen to events emitted by any instance of this object.

See also listen() in JX.Stratcom.

JX.Base

Static listen interface for listening to events produced by any instance of this class. See listen() for documentation.

Parameters
stringtypeType of event to listen for.
functioncallbackFunction to call when this event occurs.
Return
objectA reference to the installed listener. You can later remove the listener by calling this object's remove() method.

Setting cookies involves setting up a cookie object which is eventually written.

var prefs = new JX.Cookie('prefs');
prefs.setDaysToLive(5);
prefs.setValue('1,0,10,1350');
prefs.setSecure();
prefs.write();

Retrieving a cookie from the browser requires only a read() call on the cookie object. However, because cookies have such a complex API you may not be able to get your value this way if a path or domain was set when the cookie was written. Good luck with that.

var prefs_string = new JX.Cookie('prefs').read();

There is no real API in HTTP for deleting a cookie aside from setting the cookie to expire immediately. This dispose method will null out the value and expire the cookie as well.

new JX.Cookie('prefs').dispose();
Parameters
key
This method is not documented.
Defined
lib/Cookie.js:19
Extends
JX.Base