Skip to content
This repository has been archived by the owner on Jun 11, 2022. It is now read-only.

Commit

Permalink
Fix deserializer for SvgPreviewView
Browse files Browse the repository at this point in the history
  • Loading branch information
josa42 committed Dec 30, 2016
1 parent 0cbabd8 commit b5afea9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## 0.10.2
- Fix bugs related to not properly deactivating the package.

## 0.10.1
- Fix zoom reset on save

Expand Down
25 changes: 12 additions & 13 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,36 @@ import url from 'url'

let SvgPreviewView = null

function createSvgPreviewView(state) {
function importSvgPreviewView() {
if (SvgPreviewView == null) {
SvgPreviewView = require('./svg-preview-view')
}
}

function createSvgPreviewView(state) {
importSvgPreviewView()
return new SvgPreviewView(state)
}

function isSvgPreviewView(object) {
if (SvgPreviewView == null) {
SvgPreviewView = require('./svg-preview-view')
}
importSvgPreviewView()
return object instanceof SvgPreviewView
}

function configGet(key) {
return atom.config.get(`svg-preview.${key}`)
}

atom.deserializers.add({
name: 'SvgPreviewView',
deserialize(state) {
if (state.constructor === Object) {
return createSvgPreviewView(state)
}
}
})

module.exports = {

config: require('./config'),

deserializeSvgPreviewView(state) {
if (state.constructor === Object) {
return createSvgPreviewView(state)
}
},

activate() {
this.disposables = new CompositeDisposable

Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,8 @@
"devDependencies": {
"temp": "^0.8.3",
"wrench": "^1.5.9"
},
"deserializers": {
"SvgPreviewView": "deserializeSvgPreviewView"
}
}

0 comments on commit b5afea9

Please sign in to comment.