(refs #32)Add plugin install tab

This commit is contained in:
Naoki Takezoe
2014-06-15 13:11:08 +09:00
parent 3b2e42fd61
commit 4af4c4e7c6
6 changed files with 133 additions and 13 deletions

View File

@@ -67,12 +67,15 @@ object JavaScriptPlugin {
def define(id: String, author: String, url: String, description: String) = new JavaScriptPlugin(id, author, url, description)
def evaluateJavaScript(script: String): Any = {
def evaluateJavaScript(script: String, vars: Map[String, Any] = Map.empty): Any = {
val context = JsContext.enter()
try {
val scope = context.initStandardObjects()
scope.put("PluginSystem", scope, PluginSystem)
scope.put("JavaScriptPlugin", scope, this)
vars.foreach { case (key, value) =>
scope.put(key, scope, value)
}
val result = context.evaluateString(scope, script, "<cmd>", 1, null)
result
} finally {