Dev: Refactoring

This commit is contained in:
surunzi
2016-05-16 22:08:44 +08:00
parent 535a501e4b
commit da5d51b89c
10 changed files with 19 additions and 50 deletions

View File

@@ -5,11 +5,6 @@ import config from '../lib/config.es6'
require('./DevTools.scss');
function activeEruda(flag)
{
window.localStorage.setItem('active-eruda', flag);
}
export default class DevTools extends util.Emitter
{
constructor($parent)
@@ -147,9 +142,7 @@ export default class DevTools extends util.Emitter
}
_setHalfScreen(flag)
{
this._$el.css({
height: flag ? '50%': '100%'
});
this._$el.css({height: flag ? '50%': '100%'});
}
_appendTpl()
{
@@ -163,9 +156,9 @@ export default class DevTools extends util.Emitter
_initNavBar()
{
this._navBar = new NavBar(this._$el.find('.eruda-nav-bar ul'));
this._navBar.on('showTool', (name) =>
{
this.showTool(name);
});
this._navBar.on('showTool', name => this.showTool(name));
}
}
}
var activeEruda = flag => window.localStorage.setItem('active-eruda', flag);

View File

@@ -36,16 +36,14 @@ export default class NavBar extends util.Emitter
{
var $this = util.$(this);
$this.text() === name ? $this.addClass('eruda-active') : $this.rmClass('eruda-active');
$this[$this.text() === name ? 'addClass' : 'rmClass']('eruda-active');
});
}
_bindEvent()
{
var $el = this._$el;
var self = this;
$el.on('click', 'li', function ()
this._$el.on('click', 'li', function ()
{
self.emit('showTool', util.$(this).text());
});