Mercurial > hg > dml-open-vis
annotate src/DML/MainVisBundle/Resources/assets/marionette/modules/ContextModule/ContextModule.20-StateBookmark.js @ 1:f38015048f48 tip
Added GPL
author | Daniel Wolff |
---|---|
date | Sat, 13 Feb 2016 20:43:38 +0100 |
parents | 493bcb69166c |
children |
rev | line source |
---|---|
Daniel@0 | 1 "use strict"; |
Daniel@0 | 2 |
Daniel@0 | 3 App.module("ContextModule", function(ContextModule, App, Backbone, Marionette, $, _, Logger) { |
Daniel@0 | 4 |
Daniel@0 | 5 // Define private variables |
Daniel@0 | 6 var logger = null; |
Daniel@0 | 7 |
Daniel@0 | 8 ContextModule.addInitializer(function(options){ |
Daniel@0 | 9 |
Daniel@0 | 10 // logger = Logger.get("ContextModule.StateBookmark"); |
Daniel@0 | 11 // logger.setLevel(Logger.DEBUG); |
Daniel@0 | 12 |
Daniel@0 | 13 /** |
Daniel@0 | 14 * StateBookmark contains a named serialized state |
Daniel@0 | 15 */ |
Daniel@0 | 16 ContextModule.StateBookmark = Backbone.Model.extend({ |
Daniel@0 | 17 defaults: { |
Daniel@0 | 18 name: null, |
Daniel@0 | 19 time: null, |
Daniel@0 | 20 serializedState: null, |
Daniel@0 | 21 comment: null, |
Daniel@0 | 22 }, |
Daniel@0 | 23 |
Daniel@0 | 24 /** |
Daniel@0 | 25 * @memberOf App.ContextModule.StateBookmark |
Daniel@0 | 26 */ |
Daniel@0 | 27 initialize: function() { |
Daniel@0 | 28 }, |
Daniel@0 | 29 |
Daniel@0 | 30 serialize: function() { |
Daniel@0 | 31 logger.debug("method called: State::serialize"); |
Daniel@0 | 32 |
Daniel@0 | 33 var result = _.clone(this.attributes); |
Daniel@0 | 34 |
Daniel@0 | 35 return result; |
Daniel@0 | 36 }, |
Daniel@0 | 37 |
Daniel@0 | 38 unserialize: function(serializedAttributes) { |
Daniel@0 | 39 this.clear({silent: true}).set(serializedAttributes); |
Daniel@0 | 40 }, |
Daniel@0 | 41 }); |
Daniel@0 | 42 |
Daniel@0 | 43 }); |
Daniel@0 | 44 }, Logger); |