fix(lib/jsrunner): use the key parameter in MustGet instead of hardcoded "elkResult"
Signed-off-by: chai2010 <chaishushan@gmail.com>
This commit is contained in:
parent
7150096840
commit
5eda1e36d7
1 changed files with 2 additions and 2 deletions
|
|
@ -34,11 +34,11 @@ func (j *jsRunner) Engine() Engine {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (j *jsRunner) MustGet(key string) (JSValue, error) {
|
func (j *jsRunner) MustGet(key string) (JSValue, error) {
|
||||||
result := j.global.Get("elkResult")
|
result := j.global.Get(key)
|
||||||
if result.IsUndefined() {
|
if result.IsUndefined() {
|
||||||
return nil, fmt.Errorf("key %q not found in global scope", key)
|
return nil, fmt.Errorf("key %q not found in global scope", key)
|
||||||
}
|
}
|
||||||
defer j.global.Set("elkResult", js.Undefined())
|
defer j.global.Set(key, js.Undefined())
|
||||||
return &jsValue{val: result}, nil
|
return &jsValue{val: result}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue