mirror of
https://github.com/liriliri/eruda.git
synced 2026-03-24 09:48:37 +08:00
Fix: Small bugs
This commit is contained in:
@@ -58,34 +58,12 @@ export default class DevTools extends util.Emitter
|
||||
|
||||
return this;
|
||||
}
|
||||
remove(name)
|
||||
{
|
||||
var tool = this._tools[name];
|
||||
|
||||
delete this._tools[name];
|
||||
this._navBar.remove(name);
|
||||
|
||||
tool.destroy();
|
||||
if (tool.active)
|
||||
{
|
||||
var keys = util.keys(this._tools);
|
||||
if (keys.length > 0) this.showTool(keys[0]);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
get(name)
|
||||
{
|
||||
var tool = this._tools[name];
|
||||
|
||||
if (tool) return tool;
|
||||
}
|
||||
destroy()
|
||||
{
|
||||
util.each(this._tools, (tool, key) => this.remove(key));
|
||||
this._navBar.destroy();
|
||||
this._$el.remove();
|
||||
}
|
||||
showTool(name)
|
||||
{
|
||||
if (this._curTool === name) return this;
|
||||
|
||||
@@ -22,16 +22,6 @@ export default class NavBar extends util.Emitter
|
||||
this._$ul.prepend(`<li class="${name}" ontouchstart>${name}</li>`);
|
||||
this._resetWidth();
|
||||
}
|
||||
remove(name)
|
||||
{
|
||||
this._len--;
|
||||
this._$ul.find(`li.${name}`).remove();
|
||||
this._resetWidth();
|
||||
}
|
||||
destroy()
|
||||
{
|
||||
this._$el.remove();
|
||||
}
|
||||
activeTool(name)
|
||||
{
|
||||
var self = this;
|
||||
|
||||
@@ -16,8 +16,4 @@ export default class Tool
|
||||
|
||||
return this;
|
||||
}
|
||||
destroy()
|
||||
{
|
||||
this._$el.remove();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user