Functions
Defined in: js-api/src/functions.ts:132
Grok functions
Constructors
Constructor
new Functions():
Functions
Returns
Functions
Accessors
clientCache
Get Signature
get clientCache():
ClientCache
Defined in: js-api/src/functions.ts:135
Controls client caching.
Returns
onAfterRunAction
Get Signature
get onAfterRunAction():
Observable<FuncCall>
Defined in: js-api/src/functions.ts:202
Returns
Observable<FuncCall>
onBeforeRunAction
Get Signature
get onBeforeRunAction():
Observable<FuncCall>
Defined in: js-api/src/functions.ts:201
Returns
Observable<FuncCall>
onParamsUpdated
Get Signature
get onParamsUpdated():
Observable<FuncCall>
Defined in: js-api/src/functions.ts:203
Returns
Observable<FuncCall>
Methods
call()
call(
name,parameters?,showProgress?,progress?):Promise<any>
Defined in: js-api/src/functions.ts:155
Calls the function [name] (namespace-qualified, such as 'Chem:SmilesToMw') with the named
[parameters], loading the owning package first if necessary.
The result depends on the number of declared outputs: exactly one output resolves to that value
(for instance a DataFrame); several outputs resolve to an object keyed by output name
(res.result1, res.result2); no outputs resolve to undefined.
Parameters
| Parameter | Type | Default value |
|---|---|---|
name | string | undefined |
parameters | object | {} |
showProgress | boolean | false |
progress | ProgressIndicator | null | null |
Returns
Promise<any>
Example
const mw = await grok.functions.call('Chem:SmilesToMw', {smiles: 'CCO'});
eval()
eval(
name,context?):Promise<any>
Defined in: js-api/src/functions.ts:161
Evaluates a GrokScript expression (or a bare function name) in [context] and returns the result; for a bare function name that is the Func itself (see find).
Parameters
| Parameter | Type |
|---|---|
name | string |
context? | Context |
Returns
Promise<any>
find()
find(
name):Promise<Func|null>
Defined in: js-api/src/functions.ts:184
Returns a function with the specified name, or null if not found. See also find.
Parameters
| Parameter | Type |
|---|---|
name | string |
Returns
Promise<Func | null>
get()
get(
name):Promise<Func>
Defined in: js-api/src/functions.ts:175
Returns a function with the specified name, or throws an error if there is no such function. See also find.
Parameters
| Parameter | Type |
|---|---|
name | string |
Returns
Promise<Func>
getCurrentCall()
getCurrentCall():
FuncCall
Defined in: js-api/src/functions.ts:197
Returns
handleOuterBracketsInColName()
handleOuterBracketsInColName(
name,escape):string
Defined in: js-api/src/functions.ts:169
Parameters
| Parameter | Type |
|---|---|
name | string |
escape | boolean |
Returns
string
parse()
parse(
command,safe?):any
Defined in: js-api/src/functions.ts:165
Parameters
| Parameter | Type | Default value |
|---|---|---|
command | string | undefined |
safe | boolean | true |
Returns
any
register()
register(
func):Func
Defined in: js-api/src/functions.ts:138
Registers a function globally.
Parameters
| Parameter | Type |
|---|---|
func | IFunctionRegistrationData |
Returns
registerParamFunc()
registerParamFunc(
name,type,run,check?,description?):void
Defined in: js-api/src/functions.ts:144
Registers a function of one parameter of the specified [type]. It is offered for matching objects in context menus and in the "Actions" pane; [check] is an optional applicability predicate.
Parameters
| Parameter | Type | Default value |
|---|---|---|
name | string | undefined |
type | "string" | "bigint" | "object" | "map" | "file" | "bool" | "int" | "double" | "byte_array" | "datetime" | "qnum" | "dataframe" | "numerical" | "categorical" | "num" | "string_list" | "dataframe_list" | "cell" | "column" | "column_list" | "graphics" | "blob" | "tablerowfiltercall" | "colfiltercall" | "bitset" | "dynamic" | "viewer" | "list" | "semantic_value" | "func" | "funccall" | "property" | "GridCellRenderArgs" | "element" | "view" | "TableView" | "User" | "Menu" | "Project" | "event_data" | "progressindicator" | "Credentials" | "ScriptEnvironment" | "Notebook" | string & object | undefined |
run | (x) => any | undefined |
check | boolean | ((x) => boolean) | null | null |
description | string | null | null |
Returns
void
scriptSync()
scriptSync(
s,variables?):any
Defined in: js-api/src/functions.ts:193
Synchronously evaluates a GrokScript expression. When variables is provided, the expression is evaluated over a fresh context built from that map only (shell variables are not visible); when omitted, it is evaluated over the shell context, as before.
Parameters
| Parameter | Type |
|---|---|
s | string |
variables? | {[name: string]: any; } |
Returns
any