Creates a cookie object with the specified name.
Argument | Type | Description |
---|---|---|
cookieName | String | Name of the cookie |
optionalDocument | Object | Document in which to store the cookie. Defaults to current document. (Optional) |
Example usage:
//Get preferences cookie, or create it this.cookie = new Mojo.Model.Cookie("NewsPrefs"); var oldNewsPrefs = this.cookie.get(); if (oldNewsPrefs) { if (oldNewsPrefs.newsVersionString == "1.0"){ featureIndexFeed = oldNewsPrefs.featureIndexFeed; featureFeedEnable = oldNewsPrefs.featureFeedEnable; featureStoryInterval = oldNewsPrefs.featureStoryInterval; feedUpdateInterval = oldNewsPrefs.feedUpdateInterval; updateDialog = oldNewsPrefs.updateDialog; } else { this.cookie.put(){ featureIndexFeed: featureIndexFeed, featureFeedEnable: featureFeedEnable, feedUpdateInterval: feedUpdateInterval, featureStoryInterval: featureStoryInterval, newsVersionString: newsVersionString } } }
0 Comments