Add: Destroy api #35

This commit is contained in:
surunzi
2017-10-05 19:01:05 +08:00
parent 77d577076e
commit c1550c01d9
11 changed files with 112 additions and 6 deletions

View File

@@ -22,6 +22,15 @@ export default class NavBar extends util.Emitter
this._$el.prepend(`<div class="eruda-nav-bar-item">${name}</div>`);
this.resetStyle();
}
remove(name)
{
this._len--;
this._$el.find('.eruda-nav-bar-item').each(function ()
{
let $this = util.$(this);
if ($this.text().toLowerCase() === name.toLowerCase()) $this.remove();
});
}
setHeight(height)
{
this._height = height;
@@ -49,6 +58,10 @@ export default class NavBar extends util.Emitter
}
});
}
destroy()
{
this._$el.remove();
}
_resetBottomBar()
{
let $bottomBar = this._$bottomBar;