fix(theme-picker): Move launch command to activate()

This commit is contained in:
Jackie Luo 2016-03-08 17:32:23 -08:00
parent f526bb2736
commit 5be8811e33
2 changed files with 12 additions and 14 deletions

View file

@ -1,23 +1,10 @@
/** @babel */
import React from 'react';
import Actions from '../../../src/flux/actions';
import ThemePicker from './theme-picker';
import ThemePickerStore from './theme-picker-store';
export function activate() {
ThemePickerStore.activate();
this.disposable = NylasEnv.commands.add("body", "window:launch-theme-picker", () => {
Actions.openModal(
children=<ThemePicker />,
height=400,
width=250,
);
});
}
export function deactivate() {
ThemePickerStore.deactivate();
this.disposable.dispose();
}

View file

@ -1,6 +1,9 @@
import React from 'react';
import Actions from '../../../src/flux/actions';
import NylasStore from 'nylas-store';
import {APMWrapper} from 'nylas-exports';
import ThemePicker from './theme-picker';
import ThemePickerActions from './theme-picker-actions';
@ -8,11 +11,18 @@ class ThemePickerStore extends NylasStore {
constructor() {
super();
this._apm = new APMWrapper();
}
activate = ()=> {
this._apm = new APMWrapper();
this.unlisten = ThemePickerActions.uninstallTheme.listen(this.uninstallTheme);
this.disposable = NylasEnv.commands.add("body", "window:launch-theme-picker", () => {
Actions.openModal(
children=<ThemePicker />,
height=400,
width=250,
);
});
}
uninstallTheme = (theme)=> {
@ -25,6 +35,7 @@ class ThemePickerStore extends NylasStore {
deactivate = ()=> {
this.unlisten();
this.disposable.dispose();
}
}