Dev: Expose snippets run api

This commit is contained in:
surunzi
2018-01-09 19:23:02 +08:00
parent 66d62175ce
commit cbfc92cdd5
2 changed files with 18 additions and 0 deletions

View File

@@ -49,6 +49,15 @@ export default class Snippets extends Tool
return this;
}
run(name)
{
let snippets = this._snippets;
for (let i = 0, len = snippets.length; i < len; i++)
{
if (snippets[i].name === name) this._run(i);
}
}
clear()
{
this._snippets = [];