Skip to content

Commit

Permalink
Move cookie parsing up a level
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Nov 19, 2018
1 parent 17f290a commit 71b6358
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
12 changes: 12 additions & 0 deletions src/JBrowse/View/Track/BlockBased.js
Expand Up @@ -76,8 +76,17 @@ return declare( [Component,DetailsMixin,FeatureFiltererMixin,Destroyable],
constructor: function( args ) {
args = args || {};

//setup config cookie


this.refSeq = args.refSeq;
this.name = args.label || this.config.label;
var cookie = this.browser.cookie("track-" + this.name);
if (cookie) {
cookie = JSON.parse(cookie)
delete cookie.type
Object.assign(this.config, cookie)
}
this.key = args.key || this.config.key || this.name;

this._changedCallback = args.changeCallback || function(){};
Expand All @@ -90,6 +99,8 @@ return declare( [Component,DetailsMixin,FeatureFiltererMixin,Destroyable],

this.store = args.store;



// retrieve any user-set style info
lang.mixin( this.config.style, this.getUserStyles() );
},
Expand Down Expand Up @@ -947,6 +958,7 @@ return declare( [Component,DetailsMixin,FeatureFiltererMixin,Destroyable],
new TrackConfigEditor( that.config )
.show( function( result ) {
// replace this track's configuration
that.browser.cookie('track-' + that.name, JSON.stringify(result.config));
that.browser.publish( '/jbrowse/v1/v/tracks/replace', [result.conf] );
});
}
Expand Down
7 changes: 0 additions & 7 deletions src/JBrowse/View/Track/CanvasFeatures.js
Expand Up @@ -103,13 +103,6 @@ return declare(
this.showTooltips = this.config.style.showTooltips;
this.displayMode = this.config.displayMode;

//setup config cookie
var cookie = this.browser.cookie("track-" + this.name);
if (cookie) {
cookie = JSON.parse(cookie)
delete cookie.type
Object.assign(this.config, cookie)
}

this._setupEventHandlers();
},
Expand Down

0 comments on commit 71b6358

Please sign in to comment.