Constructor
new module:lang/closure(func, varMapping, source, funcProperties)
Create a Closure
.
Name | Type | Description |
---|---|---|
func | function | |
varMapping | object | |
source | string | |
funcProperties | object |
- Source
Members
isLivelyClosure
PropertiesType | Description |
---|---|
boolean |
- Source
Methods
(static) fromFunction(func, varMappingopt) → {Closure}
Converts a given func
into a Closure
.
Name | Type | Attributes | Description |
---|---|---|---|
func | function | The function to derive the closure from. | |
varMapping | object | <optional> | The variable bindings for the closure. |
- Source
- Type:
- Closure
(static) fromSource(source, varMappingopt)
Creates a Closure from a JavaScript source string.
Name | Type | Attributes | Description |
---|---|---|---|
source | string | The source code defining the function. | |
varMapping | object | <optional> | The variable bindings for the closure. |
| Closure |
- Source
asFunction() → {function}
Returns the function represented by the closure.
- Source
- Type:
- function
getFunc() → {function}
Retrieve the original javascript function this closure represents.
- Source
- Type:
- function
getFuncProperties() → {object}
A function may have state attached. This returns the stored properties.
- Source
- Type:
- object
getFuncSource() → {string}
Returns the source code of the closure.
- Source
- Type:
- string
hasFuncSource() → {boolean}
Wether or not the closure has the source code of the function stored.
- Source
- Type:
- boolean
lookup(name) → {*}
Lookup the binding of a given variable name.
Name | Type | Description |
---|---|---|
name | string | The name of the variable. |
- Source
The value the variable is bound to.
- Type:
- *
recreateFunc() → {function}
Creates a real function object.
- Source
- Type:
- function
setFuncProperties() → {object}
Attaches state to the function.
- Source
- Type:
- object
setFuncSource(src)
Sets the source code of the closure.
Name | Type | Description |
---|---|---|
src | string |
- Source