Class: SC.Cookie


Extends SC.Object.

Allows for easier handling of the document.cookie object. To create a cookie, simply call SC.Cookie.create. To retrieve a cookie, use SC.Cookie.find. Cookies are not added to document.cookie, which SC.Cookie.find uses, until you have called SC.Cookie#write.

Heavy inspiration from the {@link jQuery cookie plugin}.

Defined in: cookie.js

Since:
Sproutcore 1.0

Field Summary

Class Methods

Instance Methods

Field Detail

domain String
Default value:
null
expires Integer|SC.DateTime|Date

Amount of time until the cookie expires. Set to -1 in order to delete the cookie.

If passing an Integer, it is interpreted as a number of days.

Default value:
null
isCookie Boolean
Walk like a duck
Default value:
YES
name String
Default value:
null
path String
secure Boolean

If true, the secure attribute of the cookie will be set and the cookie transmission will require a secure protocol (like HTTPS).

Default value:
NO
value String
Default value:
''

Class Method Detail

find(name)
Finds a cookie that has been stored
Parameters:
name String
The name of the cookie
Returns:
SC.Cookie object containing name and value of cookie

Instance Method Detail

destroy()
Sets SC.Cookie#expires to -1, which destroys the cookie.
write()

Writes this SC.Cookie to document.cookie and adds it to SC.Cookie collection. To find this cookie later, or on reload, use SC.Cookie.find.

See:
SC.Cookie.find
Documentation generated by JsDoc Toolkit 2.4.0 on Wed Apr 08 2015 10:02:20 GMT-0600 (CST)