ModelCookieDelegate

Objective
  • ModelCookieDelegate
  1. function ModelCookieDelegate() {
  2. }
  3.  
  4. ModelCookieDelegate.prototype = Object.create(Objective.prototype);
  5.  
  6. Object.defineProperty(ModelCookieDelegate.prototype, 'constructor', { value: ModelCookieDelegate, enumerable: false, writable: true });
  7.  
  8. ModelCookieDelegate.prototype.isSaved = function(model) {
  9.     return $.cookie(model.name) !== undefined;
  10. }
  11.  
  12. ModelCookieDelegate.prototype.readIn = function(model) {
  13.     let json = $.cookie(model.name);
  14.  
  15.     if (json !== undefined)
  16.         model.set(JSON.parse(json));
  17. }
  18.  
  19. ModelCookieDelegate.prototype.writeOut = function(model) {
  20.     $.cookie(model.name, JSON.stringify(model.get()), { path: '/' });
  21.  
  22.     model.changed = false;
  23. }
  24.  
  25. ModelCookieDelegate.prototype.clearSave = function(model) {
  26.     $.removeCookie(model.name, { path: '/' });
  27. }
SEE ALSO

ModelStorageDelegate, Model, Editor

Comments

Your comment:
[p] [b] [i] [u] [s] [quote] [pre] [br] [code] [url] [email] strip help 2000

Enter a maximum of 2000 characters.
Improve the presentation of your text with the following formatting tags:
[p]paragraph[/p], [b]bold[/b], [i]italics[/i], [u]underline[/u], [s]strike[/s], [quote]citation[/quote], [pre]as is[/pre], [br]line break,
[url]http://www.izend.org[/url], [url=http://www.izend.org]site[/url], [email]izend@izend.org[/email], [email=izend@izend.org]izend[/email],
[code]command[/code], [code=language]source code in c, java, php, html, javascript, xml, css, sql, bash, dos, make, etc.[/code].