Free the value.
()
| 107 | |
| 108 | // Free the value. |
| 109 | func (v *Value) Free() { |
| 110 | if !v.hasValidContext() || bool(C.JS_IsUndefined(v.ref)) { |
| 111 | return // No context or undefined value, nothing to free |
| 112 | } |
| 113 | if v.borrowed { |
| 114 | v.ref = C.JS_NewUndefined() |
| 115 | v.borrowed = false |
| 116 | return |
| 117 | } |
| 118 | C.JS_FreeValue(v.ctx.ref, v.ref) |
| 119 | v.ref = C.JS_NewUndefined() |
| 120 | } |
| 121 | |
| 122 | // Context returns the context of the value. |
| 123 | func (v *Value) Context() *Context { |