Skip to content

Commit

Permalink
fix: save deserialized view
Browse files Browse the repository at this point in the history
  • Loading branch information
UziTech committed Aug 4, 2020
1 parent 4341517 commit 7ff83d7
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/dec-hex-oct-bin.js
Expand Up @@ -9,7 +9,9 @@ export default {

activate(state) {
// Creates view instance.
this.view = new DecHexOctBinView();
if (!this.view) {
this.view = new DecHexOctBinView(state);
}
// Events subscribed to in atom's system can be easily cleaned up with a CompositeDisposable.
this.subscriptions = new CompositeDisposable(
// Adds an opener for the view.
Expand All @@ -33,12 +35,17 @@ export default {

// Restores view on Atom startup.
deserializeDecHexOctBinView(state) {
return new DecHexOctBinView(state);
if (this.view) {
this.view.destroy();
}
this.view = new DecHexOctBinView(state);
return this.view;
},

deactivate() {
this.subscriptions.dispose();
this.view.destroy();
this.view = null;
},

toggle() {
Expand Down

0 comments on commit 7ff83d7

Please sign in to comment.