react¶
Source: base/tealdef/scripts/react.d.tl
Notes
Types of the GUI's React-style library, ::/gui/main/react.lua (React). A recipe is a function that
returns GUI nodes; it is registered once with React.RegisterRecipe and called like a function to
create nodes. Inside a recipe, hooks such as useState, useRef, onStep and onEvent keep state
between renders. The built-in widgets are in ::/gui/main/builtin.lua (Builtin).
Example
-- from base/content/gui/gui/main/main_mod_button_area.tl (shortened)
local react = ug_require "::/gui/main/react.lua" as React
local builtin = ug_require "::/gui/main/builtin.lua" as Builtin
local MainModButtonArea = react.RegisterRecipe("MainModButtonArea", function(params : MainModButtonAreaParams) : TreeNodeId
local selfRef = react.useSelfRef()
local focusableState = react.useState(false)
react.onEvent("focusMainModButtonArea", function()
focusableState:set(true)
selfRef:get():focus()
end)
react.useInputAction("IA_MENU_BACK", react.iaHandler(function()
focusableState:set(false)
end))
return builtin.FloatingLayout {
children = {
builtin.ScrollArea {
meta = { disableFocusableRecursive = not focusableState:old() },
content = builtin.Component { meta = { class = "scroll-area-content" } },
},
},
}
end)
Globals¶
Types
| Name | Definition | Description |
|---|---|---|
Builtin |
declared here, defined in Builtin |
The built-in widget library returned by ug_require "::/gui/main/builtin.lua": recipes for layouts, text, images, buttons, inputs, windows, charts and the game's tool and renderer components. Most widget parameters are engine classes, so a parameter table may only contain the declared fields (an unknown key raises an error). Enumerations are in builtin.type. |
RefFill¶
record global base/tealdef/scripts/react.d.tl:5
global record RefFill
Notes
Marker returned by React.ref; pass it as the first argument of a recipe call to fill a node ref with the created node.
ReactStyle¶
record base/tealdef/scripts/react.d.tl:7
record ReactStyle
Notes
Marker returned by React.style; pass it before the parameters of a recipe call to set style classes.
IRecipeParamWithMeta¶
interface global base/tealdef/scripts/react.d.tl:9
global interface IRecipeParamWithMeta
Notes
Recipe parameters that accept a meta table.
Fields
| Name | Type | Description |
|---|---|---|
meta |
Meta |
Common node settings (style class, local key, tooltip, focus, tag); see Meta. |
TreeNodeId¶
record global base/tealdef/scripts/react.d.tl:13
global record TreeNodeId
Notes
Handle of a GUI node created by a recipe call. Recipes return one, a list of them, or nil.
IRecipe¶
interface global base/tealdef/scripts/react.d.tl:15
global interface IRecipe
Notes
Anything that can be called as a recipe.
Functions
metamethod __call(IRecipe, any) : TreeNodeId base/tealdef/scripts/react.d.tl:16
Call as IRecipe(…)
Notes
Creates a node of this recipe.
Returns TreeNodeId
Recipe0¶
record global base/tealdef/scripts/react.d.tl:19
global record Recipe0 is IRecipe
Notes
A recipe without parameters, as returned by RegisterRecipe for a function without arguments.
Functions
metamethod __call(Recipe0) : TreeNodeId base/tealdef/scripts/react.d.tl:20
Call as Recipe0(…)
Notes
Creates a node: MyRecipe(). Optional leading arguments are a React.ref(...) and a React.style{...}.
Returns TreeNodeId
metamethod __call(Recipe0, RefFill) : TreeNodeId base/tealdef/scripts/react.d.tl:21
Call as Recipe0(…)
Notes
Creates a node: MyRecipe(). Optional leading arguments are a React.ref(...) and a React.style{...}.
Returns TreeNodeId
metamethod __call(Recipe0, ReactStyle) : TreeNodeId base/tealdef/scripts/react.d.tl:22
Call as Recipe0(…)
Notes
Creates a node: MyRecipe(). Optional leading arguments are a React.ref(...) and a React.style{...}.
Returns TreeNodeId
metamethod __call(Recipe0, RefFill, ReactStyle) : TreeNodeId base/tealdef/scripts/react.d.tl:23
Call as Recipe0(…)
Notes
Creates a node: MyRecipe(). Optional leading arguments are a React.ref(...) and a React.style{...}.
Returns TreeNodeId
Recipe¶
record global base/tealdef/scripts/react.d.tl:26
global record Recipe<T> is IRecipe
Notes
A recipe with one parameter table T.
Functions
metamethod __call(Recipe<T>, ?T) : TreeNodeId base/tealdef/scripts/react.d.tl:27
Call as Recipe(…)
Notes
Creates a node: MyRecipe(params). Optional leading arguments are a React.ref(...) and a
React.style{...}, in either order. A meta field in params is taken out and applied to the node.
Returns TreeNodeId
metamethod __call(Recipe<T>, ?RefFill, ?T) : TreeNodeId base/tealdef/scripts/react.d.tl:28
Call as Recipe(…)
Notes
Creates a node: MyRecipe(params). Optional leading arguments are a React.ref(...) and a
React.style{...}, in either order. A meta field in params is taken out and applied to the node.
Returns TreeNodeId
metamethod __call(Recipe<T>, ?ReactStyle, ?T) : TreeNodeId base/tealdef/scripts/react.d.tl:29
Call as Recipe(…)
Notes
Creates a node: MyRecipe(params). Optional leading arguments are a React.ref(...) and a
React.style{...}, in either order. A meta field in params is taken out and applied to the node.
Returns TreeNodeId
metamethod __call(Recipe<T>, ?RefFill, ?ReactStyle, ?T) : TreeNodeId base/tealdef/scripts/react.d.tl:30
Call as Recipe(…)
Notes
Creates a node: MyRecipe(params). Optional leading arguments are a React.ref(...) and a
React.style{...}, in either order. A meta field in params is taken out and applied to the node.
Returns TreeNodeId
Recipe2¶
record global base/tealdef/scripts/react.d.tl:33
global record Recipe2<T, T2> is IRecipe
Notes
A recipe with two parameters.
Functions
metamethod __call(Recipe2<T, T2>, T, T2) : TreeNodeId base/tealdef/scripts/react.d.tl:34
Call as Recipe2(…)
Notes
Creates a node; optional React.ref(...) and React.style{...} arguments go before the parameters.
Returns TreeNodeId
metamethod __call(Recipe2<T, T2>, RefFill, T, T2) : TreeNodeId base/tealdef/scripts/react.d.tl:35
Call as Recipe2(…)
Notes
Creates a node; optional React.ref(...) and React.style{...} arguments go before the parameters.
Returns TreeNodeId
metamethod __call(Recipe2<T, T2>, ReactStyle, T, T2) : TreeNodeId base/tealdef/scripts/react.d.tl:36
Call as Recipe2(…)
Notes
Creates a node; optional React.ref(...) and React.style{...} arguments go before the parameters.
Returns TreeNodeId
metamethod __call(Recipe2<T, T2>, RefFill, ReactStyle, T, T2) : TreeNodeId base/tealdef/scripts/react.d.tl:37
Call as Recipe2(…)
Notes
Creates a node; optional React.ref(...) and React.style{...} arguments go before the parameters.
Returns TreeNodeId
Recipe3¶
record global base/tealdef/scripts/react.d.tl:40
global record Recipe3<T, T2, T3> is IRecipe
Notes
A recipe with three parameters.
Functions
metamethod __call(Recipe3<T, T2, T3>, T, T2, T3) : TreeNodeId base/tealdef/scripts/react.d.tl:41
Call as Recipe3(…)
Notes
Creates a node; optional React.ref(...) and React.style{...} arguments go before the parameters.
Returns TreeNodeId
metamethod __call(Recipe3<T, T2, T3>, RefFill, T, T2, T3) : TreeNodeId base/tealdef/scripts/react.d.tl:42
Call as Recipe3(…)
Notes
Creates a node; optional React.ref(...) and React.style{...} arguments go before the parameters.
Returns TreeNodeId
metamethod __call(Recipe3<T, T2, T3>, ReactStyle, T, T2, T3) : TreeNodeId base/tealdef/scripts/react.d.tl:43
Call as Recipe3(…)
Notes
Creates a node; optional React.ref(...) and React.style{...} arguments go before the parameters.
Returns TreeNodeId
metamethod __call(Recipe3<T, T2, T3>, RefFill, ReactStyle, T, T2, T3) : TreeNodeId base/tealdef/scripts/react.d.tl:44
Call as Recipe3(…)
Notes
Creates a node; optional React.ref(...) and React.style{...} arguments go before the parameters.
Returns TreeNodeId
Recipe4¶
record global base/tealdef/scripts/react.d.tl:47
global record Recipe4<T, T2, T3, T4> is IRecipe
Notes
A recipe with four parameters.
Functions
metamethod __call(Recipe4<T, T2, T3, T4>, T, T2, T3, T4) : TreeNodeId base/tealdef/scripts/react.d.tl:48
Call as Recipe4(…)
Notes
Creates a node; optional React.ref(...) and React.style{...} arguments go before the parameters.
Returns TreeNodeId
metamethod __call(Recipe4<T, T2, T3, T4>, RefFill, T, T2, T3, T4) : TreeNodeId base/tealdef/scripts/react.d.tl:49
Call as Recipe4(…)
Notes
Creates a node; optional React.ref(...) and React.style{...} arguments go before the parameters.
Returns TreeNodeId
metamethod __call(Recipe4<T, T2, T3, T4>, ReactStyle, T, T2, T3, T4) : TreeNodeId base/tealdef/scripts/react.d.tl:50
Call as Recipe4(…)
Notes
Creates a node; optional React.ref(...) and React.style{...} arguments go before the parameters.
Returns TreeNodeId
metamethod __call(Recipe4<T, T2, T3, T4>, RefFill, ReactStyle, T, T2, T3, T4) : TreeNodeId base/tealdef/scripts/react.d.tl:51
Call as Recipe4(…)
Notes
Creates a node; optional React.ref(...) and React.style{...} arguments go before the parameters.
Returns TreeNodeId
RecipeWithApi0¶
record global base/tealdef/scripts/react.d.tl:54
global record RecipeWithApi0<Api>
Notes
A recipe without parameters whose nodes offer an API (set with React.provideApi), reached through a node ref's getApi().
Functions
metamethod __call(RecipeWithApi0<Api>) : TreeNodeId base/tealdef/scripts/react.d.tl:55
Call as RecipeWithApi0(…)
Notes
Creates a node; optional React.ref(...) and React.style{...} arguments.
Returns TreeNodeId
metamethod __call(RecipeWithApi0<Api>, RefFill) : TreeNodeId base/tealdef/scripts/react.d.tl:56
Call as RecipeWithApi0(…)
Notes
Creates a node; optional React.ref(...) and React.style{...} arguments.
Returns TreeNodeId
metamethod __call(RecipeWithApi0<Api>, ReactStyle) : TreeNodeId base/tealdef/scripts/react.d.tl:57
Call as RecipeWithApi0(…)
Notes
Creates a node; optional React.ref(...) and React.style{...} arguments.
Returns TreeNodeId
metamethod __call(RecipeWithApi0<Api>, RefFill, ReactStyle) : TreeNodeId base/tealdef/scripts/react.d.tl:58
Call as RecipeWithApi0(…)
Notes
Creates a node; optional React.ref(...) and React.style{...} arguments.
Returns TreeNodeId
RecipeWithApi¶
record global base/tealdef/scripts/react.d.tl:61
global record RecipeWithApi<T, Api> is IRecipe
Notes
A recipe with one parameter whose nodes offer an API (set with React.provideApi).
Functions
metamethod __call(RecipeWithApi<T, Api>, T) : TreeNodeId base/tealdef/scripts/react.d.tl:62
Call as RecipeWithApi(…)
Notes
Creates a node; optional React.ref(...) and React.style{...} arguments go before the parameters.
Returns TreeNodeId
metamethod __call(RecipeWithApi<T, Api>, RefFill, T) : TreeNodeId base/tealdef/scripts/react.d.tl:63
Call as RecipeWithApi(…)
Notes
Creates a node; optional React.ref(...) and React.style{...} arguments go before the parameters.
Returns TreeNodeId
metamethod __call(RecipeWithApi<T, Api>, ReactStyle, T) : TreeNodeId base/tealdef/scripts/react.d.tl:64
Call as RecipeWithApi(…)
Notes
Creates a node; optional React.ref(...) and React.style{...} arguments go before the parameters.
Returns TreeNodeId
metamethod __call(RecipeWithApi<T, Api>, RefFill, ReactStyle, T) : TreeNodeId base/tealdef/scripts/react.d.tl:65
Call as RecipeWithApi(…)
Notes
Creates a node; optional React.ref(...) and React.style{...} arguments go before the parameters.
Returns TreeNodeId
RecipeWithApi2¶
record global base/tealdef/scripts/react.d.tl:68
global record RecipeWithApi2<T, T2, Api>
Notes
A recipe with two parameters whose nodes offer an API.
Functions
metamethod __call(RecipeWithApi2<T, T2, Api>, T, T2) : TreeNodeId base/tealdef/scripts/react.d.tl:69
Call as RecipeWithApi2(…)
Notes
Creates a node; optional React.ref(...) and React.style{...} arguments go before the parameters.
Returns TreeNodeId
metamethod __call(RecipeWithApi2<T, T2, Api>, RefFill, T, T2) : TreeNodeId base/tealdef/scripts/react.d.tl:70
Call as RecipeWithApi2(…)
Notes
Creates a node; optional React.ref(...) and React.style{...} arguments go before the parameters.
Returns TreeNodeId
metamethod __call(RecipeWithApi2<T, T2, Api>, ReactStyle, T, T2) : TreeNodeId base/tealdef/scripts/react.d.tl:71
Call as RecipeWithApi2(…)
Notes
Creates a node; optional React.ref(...) and React.style{...} arguments go before the parameters.
Returns TreeNodeId
metamethod __call(RecipeWithApi2<T, T2, Api>, RefFill, ReactStyle, T, T2) : TreeNodeId base/tealdef/scripts/react.d.tl:72
Call as RecipeWithApi2(…)
Notes
Creates a node; optional React.ref(...) and React.style{...} arguments go before the parameters.
Returns TreeNodeId
RecipeWithApi3¶
record global base/tealdef/scripts/react.d.tl:75
global record RecipeWithApi3<T, T2, T3, Api>
Notes
A recipe with three parameters whose nodes offer an API.
Functions
metamethod __call(RecipeWithApi3<T, T2, T3, Api>, T, T2, T3) : TreeNodeId base/tealdef/scripts/react.d.tl:76
Call as RecipeWithApi3(…)
Notes
Creates a node; optional React.ref(...) and React.style{...} arguments go before the parameters.
Returns TreeNodeId
metamethod __call(RecipeWithApi3<T, T2, T3, Api>, RefFill, T, T2, T3) : TreeNodeId base/tealdef/scripts/react.d.tl:77
Call as RecipeWithApi3(…)
Notes
Creates a node; optional React.ref(...) and React.style{...} arguments go before the parameters.
Returns TreeNodeId
metamethod __call(RecipeWithApi3<T, T2, T3, Api>, ReactStyle, T, T2, T3) : TreeNodeId base/tealdef/scripts/react.d.tl:78
Call as RecipeWithApi3(…)
Notes
Creates a node; optional React.ref(...) and React.style{...} arguments go before the parameters.
Returns TreeNodeId
metamethod __call(RecipeWithApi3<T, T2, T3, Api>, RefFill, ReactStyle, T, T2, T3) : TreeNodeId base/tealdef/scripts/react.d.tl:79
Call as RecipeWithApi3(…)
Notes
Creates a node; optional React.ref(...) and React.style{...} arguments go before the parameters.
Returns TreeNodeId
ExtensionPoint0¶
record global base/tealdef/scripts/react.d.tl:82
global record ExtensionPoint0
Notes
A named place in the GUI where other mods can add plugin recipes without parameters. Created with
React.RegisterExtensionPoint0.
Fields
| Name | Type | Description |
|---|---|---|
id |
string |
Full name, "<modId>::<name>". |
ExtensionPoint¶
record global base/tealdef/scripts/react.d.tl:85
global record ExtensionPoint<RecipeParam>
Notes
A named place in the GUI where plugin recipes with the parameter RecipeParam can be added.
Fields
| Name | Type | Description |
|---|---|---|
id |
string |
Full name, "<modId>::<name>". |
WrapperExtensionPoint0¶
record global base/tealdef/scripts/react.d.tl:88
global record WrapperExtensionPoint0<WrappedRecipe>
Notes
An extension point whose plugins must return a node of wrappedRecipe (or nothing).
Fields
| Name | Type | Description |
|---|---|---|
wrappedRecipe |
WrappedRecipe |
The recipe every plugin must return. |
id |
string |
Full name, "<modId>::<name>". |
WrapperExtensionPoint¶
record global base/tealdef/scripts/react.d.tl:92
global record WrapperExtensionPoint<WrappedRecipe, RecipeParam>
Notes
An extension point with parameters whose plugins must return a node of wrappedRecipe.
Fields
| Name | Type | Description |
|---|---|---|
wrappedRecipe |
WrappedRecipe |
The recipe every plugin must return. |
id |
string |
Full name, "<modId>::<name>". |
Meta¶
record global base/tealdef/scripts/react.d.tl:97
global record Meta
Notes
Settings in the meta field of recipe parameters. class and localKey apply to the node itself;
the other fields wrap the node in a Builtin.WithComponentParams node.
Fields
| Name | Type | Description |
|---|---|---|
localKey |
string |
Key that keeps the node's identity (and state) between renders when its position among its siblings changes. |
id |
string |
Element id of the node, as used by api.gui.byId (e.g. window ids such as "menu.pause"). |
tag |
string |
Tag of the node; the context help looks up its help page by tag (e.g. "menu.finances.charts"). |
tooltip |
string |
Tooltip text. |
tooltipModifierInputAction |
string |
append this IA's key to the tooltip (regardless of what the key currently does) |
tooltipSource |
ReactRefWrap |
Node whose tooltip is shown for this node. |
class |
string |
Style class(es) of the node; overrides a React.style{class = ...} argument (with a warning). |
forceFocusable |
boolean |
Makes the node focusable even if it would not be. |
disableFocusableRecursive |
boolean |
Makes the node and all its children non-focusable. |
enabled |
boolean |
False disables the node. |
styleSheet |
StyleSheet |
Style sheet applied to the node. |
mouseCursorOverride |
number |
Mouse cursor shown over the node, e.g. gui_react_util.getMouseCursorInteger("Default"). |
discardNodeIdentity |
boolean |
force the node to be fully regenerated (it will lose its state and its UI elements). |
Functions
onMouseOver(isHovered : boolean) base/tealdef/scripts/react.d.tl:109
Notes
Called when the mouse starts or stops hovering the node.
onFocusChange(hasFocus : boolean) base/tealdef/scripts/react.d.tl:110
Notes
Called when the node gains or loses focus.
onAttention(attention : boolean) base/tealdef/scripts/react.d.tl:115
Callback when "attention" changes. With "attention" we refer to the node having focus (in gamepad mode) or being hovered with the mouse. Note that this is not directly tied to :hover pseudo-class (you can have attention even with pseudo-class :active, but :hover would be ruled out by :active)
ReactState¶
record global base/tealdef/scripts/react.d.tl:123
global record ReactState
Notes
State created with React.useState. A change with set or transform renders the recipe again.
old() returns the value of the current render.
Functions
old(ReactState) : any base/tealdef/scripts/react.d.tl:124
Call as reactState:old(…) (method)
Notes
Returns the value of the current render.
Returns any
set(ReactState, any) base/tealdef/scripts/react.d.tl:125
Call as reactState:set(…) (method)
Notes
Sets a new value; the recipe renders again with it.
transform(ReactState, function(any) : any) base/tealdef/scripts/react.d.tl:126
Call as reactState:transform(…) (method)
Notes
Sets the value to fn(current value).
hasExpired(ReactState) : boolean base/tealdef/scripts/react.d.tl:127
Call as reactState:hasExpired(…) (method)
Notes
True if the node that owns the state no longer exists (e.g. when called from a callback after unmount).
Returns boolean
ReactStateT¶
record global base/tealdef/scripts/react.d.tl:130
global record ReactStateT<T>
Notes
Typed state created with React.useState(initialValue); see ReactState.
Functions
old(ReactStateT<T>) : T base/tealdef/scripts/react.d.tl:131
Call as reactStateT:old(…) (method)
Notes
Returns the value of the current render.
Returns T
set(ReactStateT<T>, T) base/tealdef/scripts/react.d.tl:132
Call as reactStateT:set(…) (method)
Notes
Sets a new value; the recipe renders again with it.
transform(ReactStateT<T>, function(T) : T) base/tealdef/scripts/react.d.tl:133
Call as reactStateT:transform(…) (method)
Notes
Sets the value to fn(current value).
hasExpired(ReactStateT<T>) : boolean base/tealdef/scripts/react.d.tl:134
Call as reactStateT:hasExpired(…) (method)
Notes
True if the node that owns the state no longer exists.
Returns boolean
ReactRefT¶
record global base/tealdef/scripts/react.d.tl:137
global record ReactRefT<T>
Notes
A value kept between renders, created with React.useRef. Unlike a state, changing it does not
render the recipe again.
Functions
get(ReactRefT<T>) : T base/tealdef/scripts/react.d.tl:138
Call as reactRefT:get(…) (method)
Notes
Returns the stored value.
Returns T
set(ReactRefT<T>, T) base/tealdef/scripts/react.d.tl:139
Call as reactRefT:set(…) (method)
Notes
Stores a value without rendering again.
transform(ReactRefT, function(T) : T) base/tealdef/scripts/react.d.tl:140
Call as reactRefT:transform(…) (method)
Notes
Stores fn(current value).
hasExpired(ReactRefT<T>) : boolean base/tealdef/scripts/react.d.tl:141
Call as reactRefT:hasExpired(…) (method)
Notes
True if the node that owns the ref no longer exists.
Returns boolean
ReactRefWrap¶
record global base/tealdef/scripts/react.d.tl:144
global record ReactRefWrap
Notes
A ref to a GUI node, from React.useNodeRef() or React.useSelfRef().
Functions
get(ReactRefWrap) : ReactNodeRef base/tealdef/scripts/react.d.tl:145
Call as reactRefWrap:get(…) (method)
Notes
Returns the node, or nil before the node exists.
Returns ReactNodeRef
set(ReactRefWrap, any) base/tealdef/scripts/react.d.tl:146
Call as reactRefWrap:set(…) (method)
Notes
Stores a node; React.ref(...) does this when the node is created.
transform(ReactRefWrap, function(any) : any) base/tealdef/scripts/react.d.tl:147
Call as reactRefWrap:transform(…) (method)
Notes
Stores fn(current value).
hasExpired(ReactRefWrap) : boolean base/tealdef/scripts/react.d.tl:148
Call as reactRefWrap:hasExpired(…) (method)
Notes
True if the node that owns the ref no longer exists.
Returns boolean
ReactNodeRefT¶
record global base/tealdef/scripts/react.d.tl:151
global record ReactNodeRefT<T>
Notes
Access to a created node of a recipe with parameter type T.
Functions
focus(ReactNodeRefT<T>) base/tealdef/scripts/react.d.tl:152
Call as reactNodeRefT:focus(…) (method)
Notes
Gives the node the focus.
containsPosition(ReactNodeRefT<T>, position : Vec2i) : boolean base/tealdef/scripts/react.d.tl:153
Call as reactNodeRefT:containsPosition(…) (method)
Notes
True if the screen position lies inside the node.
Returns boolean
getPosition(ReactNodeRefT<T>, gravityX : number, gravityY : number) : Vec2f base/tealdef/scripts/react.d.tl:154
Call as reactNodeRefT:getPosition(…) (method)
Notes
Screen position of a point of the node; gravityX/gravityY 0 is the left/top edge and 1 the right/bottom edge.
Returns Vec2f
ensureVisible(ReactNodeRefT<T>) base/tealdef/scripts/react.d.tl:155
Call as reactNodeRefT:ensureVisible(…) (method)
Notes
Scrolls the surrounding scroll areas so the node is visible.
setSelectedRecursive(ReactNodeRefT<T>, selected : boolean) base/tealdef/scripts/react.d.tl:156
Call as reactNodeRefT:setSelectedRecursive(…) (method)
Notes
Sets the selected state of the node and its children.
ReactNodeRefApiT¶
record global base/tealdef/scripts/react.d.tl:158
global record ReactNodeRefApiT<T, Api>
Notes
Access to a created node of a recipe with an API.
Functions
getApi(ReactNodeRefApiT<T, Api>) : Api base/tealdef/scripts/react.d.tl:159
Call as reactNodeRefApiT:getApi(…) (method)
Notes
Returns the API the recipe set with React.provideApi.
Returns Api
focus(ReactNodeRefApiT<T, Api>) base/tealdef/scripts/react.d.tl:160
Call as reactNodeRefApiT:focus(…) (method)
Notes
Gives the node the focus.
containsPosition(ReactNodeRefApiT<T, Api>, position : Vec2i) : boolean base/tealdef/scripts/react.d.tl:161
Call as reactNodeRefApiT:containsPosition(…) (method)
Notes
True if the screen position lies inside the node.
Returns boolean
getPosition(ReactNodeRefApiT<T, Api>, gravityX : number, gravityY : number) : Vec2f base/tealdef/scripts/react.d.tl:162
Call as reactNodeRefApiT:getPosition(…) (method)
Notes
Screen position of a point of the node; gravityX/gravityY 0 is the left/top edge and 1 the right/bottom edge.
Returns Vec2f
getIdentity(ReactNodeRefApiT<T, Api>) : integer base/tealdef/scripts/react.d.tl:163
Call as reactNodeRefApiT:getIdentity(…) (method)
Notes
Identity number of the node; nil when the node does not exist (the base game checks it before getApi()).
Returns integer
ensureVisible(ReactNodeRefApiT<T, Api>) base/tealdef/scripts/react.d.tl:164
Call as reactNodeRefApiT:ensureVisible(…) (method)
Notes
Scrolls the surrounding scroll areas so the node is visible.
setSelectedRecursive(ReactNodeRefApiT<T, Api>, selected : boolean) base/tealdef/scripts/react.d.tl:165
Call as reactNodeRefApiT:setSelectedRecursive(…) (method)
Notes
Sets the selected state of the node and its children.
ReactNodeRefApi0¶
record global base/tealdef/scripts/react.d.tl:167
global record ReactNodeRefApi0<Api>
Notes
Access to a created node of a parameterless recipe with an API.
Functions
getApi(ReactNodeRefApi0<Api>) : Api base/tealdef/scripts/react.d.tl:168
Call as reactNodeRefApi0:getApi(…) (method)
Notes
Returns the API the recipe set with React.provideApi.
Returns Api
focus(ReactNodeRefApi0<Api>) base/tealdef/scripts/react.d.tl:169
Call as reactNodeRefApi0:focus(…) (method)
Notes
Gives the node the focus.
containsPosition(ReactNodeRefApi0<Api>, position : Vec2i) : boolean base/tealdef/scripts/react.d.tl:170
Call as reactNodeRefApi0:containsPosition(…) (method)
Notes
True if the screen position lies inside the node.
Returns boolean
getPosition(ReactNodeRefApi0<Api>, gravityX : number, gravityY : number) : Vec2f base/tealdef/scripts/react.d.tl:171
Call as reactNodeRefApi0:getPosition(…) (method)
Notes
Screen position of a point of the node; gravityX/gravityY 0 is the left/top edge and 1 the right/bottom edge.
Returns Vec2f
getIdentity(ReactNodeRefApi0<Api>) : integer base/tealdef/scripts/react.d.tl:172
Call as reactNodeRefApi0:getIdentity(…) (method)
Notes
Identity number of the node.
Returns integer
ensureVisible(ReactNodeRefApi0<Api>) base/tealdef/scripts/react.d.tl:173
Call as reactNodeRefApi0:ensureVisible(…) (method)
Notes
Scrolls the surrounding scroll areas so the node is visible.
setSelectedRecursive(ReactNodeRefApi0<Api>, selected : boolean) base/tealdef/scripts/react.d.tl:174
Call as reactNodeRefApi0:setSelectedRecursive(…) (method)
Notes
Sets the selected state of the node and its children.
ReactRefWrapT¶
record global base/tealdef/scripts/react.d.tl:177
global record ReactRefWrapT<T>
Notes
Typed node ref from React.useNodeRef(SomeRecipe).
Functions
get(ReactRefWrapT<T>) : ReactNodeRefT<T> base/tealdef/scripts/react.d.tl:178
Call as reactRefWrapT:get(…) (method)
Notes
Returns the node, or nil before the node exists.
Returns ReactNodeRefT<T>
set(ReactRefWrapT<T>, ReactNodeRefT<T>) base/tealdef/scripts/react.d.tl:179
Call as reactRefWrapT:set(…) (method)
Notes
Stores a node; React.ref(...) does this when the node is created.
transform(ReactRefWrapT<T>, function(ReactNodeRefT<T>) : ReactNodeRefT<T>) base/tealdef/scripts/react.d.tl:180
Call as reactRefWrapT:transform(…) (method)
Notes
Stores fn(current value).
hasExpired(ReactRefWrapT<T>) : boolean base/tealdef/scripts/react.d.tl:181
Call as reactRefWrapT:hasExpired(…) (method)
Notes
True if the node that owns the ref no longer exists.
Returns boolean
ReactRefWrapApiT¶
record global base/tealdef/scripts/react.d.tl:184
global record ReactRefWrapApiT<T, Api>
Notes
Node ref from React.useNodeRef(SomeRecipeWithApi); its node has getApi().
Functions
get(ReactRefWrapApiT<T, Api>) : ReactNodeRefApiT<T, Api> base/tealdef/scripts/react.d.tl:185
Call as reactRefWrapApiT:get(…) (method)
Notes
Returns the node, or nil before the node exists.
Returns ReactNodeRefApiT<T, Api>
set(ReactRefWrapApiT<T, Api>, ReactNodeRefApiT<T, Api>) base/tealdef/scripts/react.d.tl:186
Call as reactRefWrapApiT:set(…) (method)
Notes
Stores a node.
transform(ReactRefWrapApiT<T, Api>, function(ReactNodeRefApiT<T, Api>) : ReactNodeRefApiT<T, Api>) base/tealdef/scripts/react.d.tl:187
Call as reactRefWrapApiT:transform(…) (method)
Notes
Stores fn(current value).
hasExpired(ReactRefWrapApiT<T, Api>) : boolean base/tealdef/scripts/react.d.tl:188
Call as reactRefWrapApiT:hasExpired(…) (method)
Notes
True if the node that owns the ref no longer exists.
Returns boolean
ReactRefWrapApi0¶
record global base/tealdef/scripts/react.d.tl:190
global record ReactRefWrapApi0<Api>
Notes
Node ref for a parameterless recipe with an API.
Functions
get(ReactRefWrapApi0<Api>) : ReactNodeRefApi0<Api> base/tealdef/scripts/react.d.tl:191
Call as reactRefWrapApi0:get(…) (method)
Notes
Returns the node, or nil before the node exists.
Returns ReactNodeRefApi0<Api>
set(ReactRefWrapApi0<Api>, ReactNodeRefApi0<Api>) base/tealdef/scripts/react.d.tl:192
Call as reactRefWrapApi0:set(…) (method)
Notes
Stores a node.
transform(ReactRefWrapApi0<Api>, function(ReactNodeRefApi0<Api>) : ReactNodeRefApi0<Api>) base/tealdef/scripts/react.d.tl:193
Call as reactRefWrapApi0:transform(…) (method)
Notes
Stores fn(current value).
hasExpired(ReactRefWrapApi0<Api>) : boolean base/tealdef/scripts/react.d.tl:194
Call as reactRefWrapApi0:hasExpired(…) (method)
Notes
True if the node that owns the ref no longer exists.
Returns boolean
ReactNodeRef¶
record global base/tealdef/scripts/react.d.tl:197
global record ReactNodeRef
Notes
Access to a created node, from an untyped ReactRefWrap.
Functions
focus(ReactNodeRef) base/tealdef/scripts/react.d.tl:198
Call as reactNodeRef:focus(…) (method)
Notes
Gives the node the focus.
containsPosition(ReactNodeRef, position : Vec2i) : boolean base/tealdef/scripts/react.d.tl:199
Call as reactNodeRef:containsPosition(…) (method)
Notes
True if the screen position lies inside the node.
Returns boolean
getPosition(ReactNodeRef, gravityX : number, gravityY : number) : Vec2f base/tealdef/scripts/react.d.tl:200
Call as reactNodeRef:getPosition(…) (method)
Notes
Screen position of a point of the node; gravityX/gravityY 0 is the left/top edge and 1 the right/bottom edge.
Returns Vec2f
getIdentity(ReactNodeRef) : integer base/tealdef/scripts/react.d.tl:201
Call as reactNodeRef:getIdentity(…) (method)
Notes
Identity number of the node.
Returns integer
ReactStyleParams¶
record global base/tealdef/scripts/react.d.tl:204
global record ReactStyleParams
Notes
Parameters of React.style.
Fields
| Name | Type | Description |
|---|---|---|
class |
string |
Style class(es) for the node. |
IReactToolDefinition¶
interface global base/tealdef/scripts/react.d.tl:208
global interface IReactToolDefinition
Notes
A tool registered with React.RegisterTool (the tool stack of the game GUI, e.g. windows such as the pause menu).
Fields
| Name | Type | Description |
|---|---|---|
name |
string |
Unique tool name; RegisterTool fails if it is missing or already taken. |
ReactToolDefinition¶
record global base/tealdef/scripts/react.d.tl:212
global record ReactToolDefinition<P> is IReactToolDefinition
Notes
Callbacks of a tool on the tool stack, with tool parameters P. tool_react_util builds the usual
window tools with prepareDefaultToolWithWindowDefinition.
Functions
push(Builtin.ToolStackContext<P>, P) base/tealdef/scripts/react.d.tl:213
Notes
Called when the tool is pushed onto the tool stack; window tools open their window here.
pop(Builtin.ToolStackContext<P>, P) base/tealdef/scripts/react.d.tl:214
Notes
Called when the tool is removed from the stack; window tools close their window here.
shelve(Builtin.ToolStackContext<P>, P, shelve : boolean) base/tealdef/scripts/react.d.tl:215
Notes
Called with true when another tool covers this one and with false when it is on top again; window tools hide and show their window.
getActiveVariant(Builtin.ToolStackContext<P>, P) : string base/tealdef/scripts/react.d.tl:217
Notes
Optional; name of the tool's active variant.
Returns string
getDebugString(Builtin.ToolStackContext<P>, P) : string base/tealdef/scripts/react.d.tl:218
Notes
Optional; text for debugging output.
Returns string
DndGrabContext¶
record global base/tealdef/scripts/react.d.tl:221
global record DndGrabContext
Notes
Context for adding drag-and-drop items.
Functions
addItem(itemType : ResName, itemData : any) base/tealdef/scripts/react.d.tl:222
Notes
Adds an item of the given type to the dragged items.
DndDropContext¶
record global base/tealdef/scripts/react.d.tl:224
global record DndDropContext
Notes
Items available when something is dropped on a node.
Functions
getItems() : {Gui.DataTransferItem} base/tealdef/scripts/react.d.tl:226
get filtered items (if filter is set), otherwise same as getAllItems
Returns {Gui.DataTransferItem}
getAllItems() : {Gui.DataTransferItem} base/tealdef/scripts/react.d.tl:227
Notes
All dragged items.
Returns {Gui.DataTransferItem}
anyMatch() : boolean base/tealdef/scripts/react.d.tl:228
Notes
True if at least one item passes the handler's filter.
Returns boolean
DndDragContext¶
record global base/tealdef/scripts/react.d.tl:230
global record DndDragContext
Notes
Items being dragged over a node (given to enter and exit).
Functions
getItems() : {Gui.DataTransferItem} base/tealdef/scripts/react.d.tl:232
get filtered items
Returns {Gui.DataTransferItem}
getAllItems() : {Gui.DataTransferItem} base/tealdef/scripts/react.d.tl:234
get all items that are currently being dragged
Returns {Gui.DataTransferItem}
anyMatch() : boolean base/tealdef/scripts/react.d.tl:236
check if at least one item matches the filter if filter
Returns boolean
DragAndDropHandler¶
record global base/tealdef/scripts/react.d.tl:238
global record DragAndDropHandler
Notes
Callbacks given to React.onDragAndDrop.
Functions
grab() : {Gui.DataTransferItem}, integer base/tealdef/scripts/react.d.tl:241
return what you started to drag, {} to deny grabbing, nil/false to let parent handle it. second return value: initial dragging mouse cursor (defaults to gui_react_util.getMouseCursorInteger("Grab"))
Returns {Gui.DataTransferItem}, integer
filter(type : ResName, data : any) : boolean base/tealdef/scripts/react.d.tl:244
optional filter, return true if an item should be accepted. If not set, all items are accepted.
Returns boolean
drop(dropContext : DndDropContext) : boolean base/tealdef/scripts/react.d.tl:245
Notes
Called when items are dropped on the node; return true if handled.
Returns boolean
enter(dropContext : DndDragContext) : boolean base/tealdef/scripts/react.d.tl:246
Notes
Called when dragged items enter the node; return true if handled.
Returns boolean
exit(dropContext : DndDragContext) : boolean base/tealdef/scripts/react.d.tl:247
Notes
Called when dragged items leave the node; return true if handled.
Returns boolean
React¶
record global base/tealdef/scripts/react.d.tl:250
global record React
Notes
The GUI library returned by ug_require "::/gui/main/react.lua".
Functions
RegisterRecipe(string, function() : TreeNodeId) : Recipe0 base/tealdef/scripts/react.d.tl:251
Notes
Registers a recipe under a name and returns it; calling the result creates nodes.
| Parameter | Type | Description |
|---|---|---|
#1 |
string |
Recipe name, used for debugging and recipe ids. |
#2 |
function() : TreeNodeId |
The render function; it returns a node, a list of nodes or nil. |
Returns Recipe0
Details
Register recipes once at file level, not inside other recipes. Hooks (useState, onStep, ...) work only while the render function runs.
RegisterRecipe<T1>(string, function(T1) : TreeNodeId) : Recipe<T1> base/tealdef/scripts/react.d.tl:252
Notes
Registers a recipe under a name and returns it; calling the result creates nodes.
| Parameter | Type | Description |
|---|---|---|
#1 |
string |
Recipe name, used for debugging and recipe ids. |
#2 |
function(T1) : TreeNodeId |
The render function; it returns a node, a list of nodes or nil. |
Returns Recipe<T1>
Details
Register recipes once at file level, not inside other recipes. Hooks (useState, onStep, ...) work only while the render function runs.
RegisterRecipe<T1, T2>(string, function(T1, T2) : TreeNodeId) : Recipe2<T1, T2> base/tealdef/scripts/react.d.tl:253
Notes
Registers a recipe under a name and returns it; calling the result creates nodes.
| Parameter | Type | Description |
|---|---|---|
#1 |
string |
Recipe name, used for debugging and recipe ids. |
#2 |
function(T1, T2) : TreeNodeId |
The render function; it returns a node, a list of nodes or nil. |
Returns Recipe2<T1, T2>
Details
Register recipes once at file level, not inside other recipes. Hooks (useState, onStep, ...) work only while the render function runs.
RegisterRecipe<T1, T2, T3>(string, function(T1, T2, T3) : TreeNodeId) : Recipe3<T1, T2, T3> base/tealdef/scripts/react.d.tl:254
Notes
Registers a recipe under a name and returns it; calling the result creates nodes.
| Parameter | Type | Description |
|---|---|---|
#1 |
string |
Recipe name, used for debugging and recipe ids. |
#2 |
function(T1, T2, T3) : TreeNodeId |
The render function; it returns a node, a list of nodes or nil. |
Returns Recipe3<T1, T2, T3>
Details
Register recipes once at file level, not inside other recipes. Hooks (useState, onStep, ...) work only while the render function runs.
RegisterRecipe<T1, T2, T3, T4>(string, function(T1, T2, T3, T4) : TreeNodeId) : Recipe4<T1, T2, T3, T4> base/tealdef/scripts/react.d.tl:255
Notes
Registers a recipe under a name and returns it; calling the result creates nodes.
| Parameter | Type | Description |
|---|---|---|
#1 |
string |
Recipe name, used for debugging and recipe ids. |
#2 |
function(T1, T2, T3, T4) : TreeNodeId |
The render function; it returns a node, a list of nodes or nil. |
Returns Recipe4<T1, T2, T3, T4>
Details
Register recipes once at file level, not inside other recipes. Hooks (useState, onStep, ...) work only while the render function runs.
RegisterWrapperRecipe<T, Params, WrappedParams>(string, Recipe<WrappedParams>, (function(T, Params) : TreeNodeId)) : Recipe<T> base/tealdef/scripts/react.d.tl:257
Notes
Registers a recipe that must return exactly one node of the wrapped recipe (or none), e.g. a window recipe built on builtin.Window.
Returns Recipe<T>
Example
-- from base/content/gui/gui/main/pause_menu.tl
local PauseMenu = react.RegisterWrapperRecipe("PauseMenu", builtin.Window, function(params : ToolReactUtil.IToolWindowParam<ToolReactUtil.IToolParam>) : TreeNodeId
return builtin.Window{ id = pauseMenuWindowId, closable = false, content = PauseMenuContent(params) }
end)
RegisterPluginRecipe(extensionPoint : ExtensionPoint0, name : string, fn : function() : TreeNodeId) : Recipe0 base/tealdef/scripts/react.d.tl:262
register a recipe that is a plugin for a specific extensionPoint
Notes
Registers a recipe as a plugin for an extension point.
Returns Recipe0
Details
Registering the recipe does not add it to the extension point. The mod also needs a generic resource
(.res.lua) of type "react-plugin <extension point id>" whose data.filePath names the recipe as
"file.script@RecipeName". For a wrapper extension point the recipe must return a node of the wrapped recipe.
Example
-- base/content/gui/gui/game_bar/game_bar_display_earnings_plugin/game_bar_display_earnings.res.lua
function data()
return {
type = "react-plugin ::GameBarInfoDisplayExtension",
data = {
filePath = "::/gui/game_bar/game_bar_display_earnings_plugin/game_bar_display_earnings.script@GameBarEarningsPlugin",
}
}
end
RegisterPluginRecipe<ParamType>(extensionPoint : ExtensionPoint<ParamType>, name : string, fn : function(ParamType) : TreeNodeId) : Recipe<ParamType> base/tealdef/scripts/react.d.tl:263
Notes
Registers a recipe as a plugin for an extension point.
Returns Recipe<ParamType>
Details
Registering the recipe does not add it to the extension point. The mod also needs a generic resource
(.res.lua) of type "react-plugin <extension point id>" whose data.filePath names the recipe as
"file.script@RecipeName". For a wrapper extension point the recipe must return a node of the wrapped recipe.
Example
-- base/content/gui/gui/game_bar/game_bar_display_earnings_plugin/game_bar_display_earnings.res.lua
function data()
return {
type = "react-plugin ::GameBarInfoDisplayExtension",
data = {
filePath = "::/gui/game_bar/game_bar_display_earnings_plugin/game_bar_display_earnings.script@GameBarEarningsPlugin",
}
}
end
RegisterPluginRecipe<WrappedRecipe>(extensionPoint : WrapperExtensionPoint0<WrappedRecipe>, name : string, fn : function() : TreeNodeId) : Recipe0 base/tealdef/scripts/react.d.tl:264
Notes
Registers a recipe as a plugin for an extension point.
Returns Recipe0
Details
Registering the recipe does not add it to the extension point. The mod also needs a generic resource
(.res.lua) of type "react-plugin <extension point id>" whose data.filePath names the recipe as
"file.script@RecipeName". For a wrapper extension point the recipe must return a node of the wrapped recipe.
Example
-- base/content/gui/gui/game_bar/game_bar_display_earnings_plugin/game_bar_display_earnings.res.lua
function data()
return {
type = "react-plugin ::GameBarInfoDisplayExtension",
data = {
filePath = "::/gui/game_bar/game_bar_display_earnings_plugin/game_bar_display_earnings.script@GameBarEarningsPlugin",
}
}
end
RegisterPluginRecipe<WrappedRecipe, ParamType>(extensionPoint : WrapperExtensionPoint<WrappedRecipe, ParamType>, name : string, fn : function(ParamType) : TreeNodeId) : Recipe<ParamType> base/tealdef/scripts/react.d.tl:265
Notes
Registers a recipe as a plugin for an extension point.
Returns Recipe<ParamType>
Details
Registering the recipe does not add it to the extension point. The mod also needs a generic resource
(.res.lua) of type "react-plugin <extension point id>" whose data.filePath names the recipe as
"file.script@RecipeName". For a wrapper extension point the recipe must return a node of the wrapped recipe.
Example
-- base/content/gui/gui/game_bar/game_bar_display_earnings_plugin/game_bar_display_earnings.res.lua
function data()
return {
type = "react-plugin ::GameBarInfoDisplayExtension",
data = {
filePath = "::/gui/game_bar/game_bar_display_earnings_plugin/game_bar_display_earnings.script@GameBarEarningsPlugin",
}
}
end
RegisterExtensionPoint0(modId : string, extensionPointName : string) : ExtensionPoint0 base/tealdef/scripts/react.d.tl:268
register an extensionPoint (its name must be unique, otherwise the call returns nil)
Notes
Creates an extension point without parameters under "<modId>::<name>".
Returns ExtensionPoint0: The extension point, or nil (with a warning) if the name is already taken.
Example
RegisterExtensionPoint<RecipeParam>(modId : string, extensionPointName : string) : ExtensionPoint<RecipeParam> base/tealdef/scripts/react.d.tl:269
Notes
Creates an extension point whose plugins take a parameter, under "<modId>::<name>".
Returns ExtensionPoint<RecipeParam>: The extension point, or nil (with a warning) if the name is already taken.
RegisterWrapperExtensionPoint0<WrappedRecipe, RecipeParam>(modId : string, extensionPointName : string, wrappedRecipe : WrappedRecipe) : WrapperExtensionPoint<WrappedRecipe, RecipeParam> base/tealdef/scripts/react.d.tl:270
Notes
Creates an extension point whose plugins must return a node of wrappedRecipe.
Returns WrapperExtensionPoint<WrappedRecipe, RecipeParam>: The extension point, or nil if the name is already taken.
RegisterWrapperExtensionPoint<WrappedRecipe, RecipeParam>(modId : string, extensionPointName : string, wrappedRecipe : WrappedRecipe) : WrapperExtensionPoint<WrappedRecipe, RecipeParam> base/tealdef/scripts/react.d.tl:271
Notes
Creates an extension point with parameters whose plugins must return a node of wrappedRecipe.
Returns WrapperExtensionPoint<WrappedRecipe, RecipeParam>: The extension point, or nil if the name is already taken.
getPlugins(extensionPoint? : ExtensionPoint0) : {ReactPlugin0} base/tealdef/scripts/react.d.tl:274
get all registered plugins for the extensionPoint (returns {} if extensionPoint is nil or otherwise unknown)
Notes
Loads the plugins of an extension point from all "react-plugin <id>" resources, sorted by order.
Returns {ReactPlugin0}: The plugins with recipe, order and condition; {} for nil or unknown extension points.
Details
gui_react_util.usePlugins calls this, evaluates the conditions and creates the plugin nodes.
getPlugins<RecipeParam>(extensionPoint? : ExtensionPoint<RecipeParam>) : {ReactPlugin<RecipeParam>} base/tealdef/scripts/react.d.tl:275
Notes
Loads the plugins of an extension point from all "react-plugin <id>" resources, sorted by order.
Returns {ReactPlugin<RecipeParam>}: The plugins with recipe, order and condition; {} for nil or unknown extension points.
Details
gui_react_util.usePlugins calls this, evaluates the conditions and creates the plugin nodes.
getPlugins<WrappedRecipe>(extensionPoint? : WrapperExtensionPoint0<WrappedRecipe>) : {ReactPlugin0} base/tealdef/scripts/react.d.tl:276
Notes
Loads the plugins of an extension point from all "react-plugin <id>" resources, sorted by order.
Returns {ReactPlugin0}: The plugins with recipe, order and condition; {} for nil or unknown extension points.
Details
gui_react_util.usePlugins calls this, evaluates the conditions and creates the plugin nodes.
getPlugins<WrappedRecipe, RecipeParam>(extensionPoint? : WrapperExtensionPoint<WrappedRecipe, RecipeParam>) : {ReactPlugin<RecipeParam>} base/tealdef/scripts/react.d.tl:277
Notes
Loads the plugins of an extension point from all "react-plugin <id>" resources, sorted by order.
Returns {ReactPlugin<RecipeParam>}: The plugins with recipe, order and condition; {} for nil or unknown extension points.
Details
gui_react_util.usePlugins calls this, evaluates the conditions and creates the plugin nodes.
CallOriginalRecipe(possiblyReplaced : Recipe0) : TreeNodeId base/tealdef/scripts/react.d.tl:280
Call the original recipe, ignoring replacement configurations. Note that this will not work for builtins.
Notes
Calls the original recipe even if a replacement is registered for it; use it inside the replacement.
Returns TreeNodeId
Details
Not allowed for builtins (logs an error and returns nil).
Example
-- from mods/release/urbangames_campaign_mission_05/content/mission/mission/perk_icons_replacement.script.tl
local PerkHudIconRepalcement = react.RegisterRecipe("PerkHudIcon", function(param : HudIconToolbox.PerkHudIconParam) : TreeNodeId
if game_react_globals.getDisableFeatures()["PerkHudIcons"] then
return nil
end
return builtin.BoxLayout{ children = { react.CallOriginalRecipe(hud_icon_toolbox.PerkHudIcon, param) } }
end)
CallOriginalRecipe<Api>(possiblyReplaced : RecipeWithApi0<Api>) : TreeNodeId base/tealdef/scripts/react.d.tl:281
Notes
Calls the original recipe even if a replacement is registered for it; use it inside the replacement.
Returns TreeNodeId
Details
Not allowed for builtins (logs an error and returns nil).
Example
-- from mods/release/urbangames_campaign_mission_05/content/mission/mission/perk_icons_replacement.script.tl
local PerkHudIconRepalcement = react.RegisterRecipe("PerkHudIcon", function(param : HudIconToolbox.PerkHudIconParam) : TreeNodeId
if game_react_globals.getDisableFeatures()["PerkHudIcons"] then
return nil
end
return builtin.BoxLayout{ children = { react.CallOriginalRecipe(hud_icon_toolbox.PerkHudIcon, param) } }
end)
CallOriginalRecipe<RecipeParam>(possiblyReplaced : Recipe<RecipeParam>, params : RecipeParam) : TreeNodeId base/tealdef/scripts/react.d.tl:282
Notes
Calls the original recipe even if a replacement is registered for it; use it inside the replacement.
Returns TreeNodeId
Details
Not allowed for builtins (logs an error and returns nil).
Example
-- from mods/release/urbangames_campaign_mission_05/content/mission/mission/perk_icons_replacement.script.tl
local PerkHudIconRepalcement = react.RegisterRecipe("PerkHudIcon", function(param : HudIconToolbox.PerkHudIconParam) : TreeNodeId
if game_react_globals.getDisableFeatures()["PerkHudIcons"] then
return nil
end
return builtin.BoxLayout{ children = { react.CallOriginalRecipe(hud_icon_toolbox.PerkHudIcon, param) } }
end)
CallOriginalRecipe<RecipeParam, Api>(possiblyReplaced : RecipeWithApi<RecipeParam, Api>, params : RecipeParam) : TreeNodeId base/tealdef/scripts/react.d.tl:283
Notes
Calls the original recipe even if a replacement is registered for it; use it inside the replacement.
Returns TreeNodeId
Details
Not allowed for builtins (logs an error and returns nil).
Example
-- from mods/release/urbangames_campaign_mission_05/content/mission/mission/perk_icons_replacement.script.tl
local PerkHudIconRepalcement = react.RegisterRecipe("PerkHudIcon", function(param : HudIconToolbox.PerkHudIconParam) : TreeNodeId
if game_react_globals.getDisableFeatures()["PerkHudIcons"] then
return nil
end
return builtin.BoxLayout{ children = { react.CallOriginalRecipe(hud_icon_toolbox.PerkHudIcon, param) } }
end)
CallOriginalRecipe<RecipeParam, UserParam>(possiblyReplaced : Recipe2<RecipeParam, UserParam>, params : RecipeParam, userParam : UserParam) : TreeNodeId base/tealdef/scripts/react.d.tl:284
Notes
Calls the original recipe even if a replacement is registered for it; use it inside the replacement.
Returns TreeNodeId
Details
Not allowed for builtins (logs an error and returns nil).
Example
-- from mods/release/urbangames_campaign_mission_05/content/mission/mission/perk_icons_replacement.script.tl
local PerkHudIconRepalcement = react.RegisterRecipe("PerkHudIcon", function(param : HudIconToolbox.PerkHudIconParam) : TreeNodeId
if game_react_globals.getDisableFeatures()["PerkHudIcons"] then
return nil
end
return builtin.BoxLayout{ children = { react.CallOriginalRecipe(hud_icon_toolbox.PerkHudIcon, param) } }
end)
RegisterTool<P>(toolDef : ReactToolDefinition<P>) : ReactToolDefinition<P> base/tealdef/scripts/react.d.tl:286
Notes
Registers a tool definition for the tool stack.
Returns ReactToolDefinition<P>: The same definition.
Details
Raises an error if the definition has no name or the name is already registered.
GetRecipeId(IRecipe) : number base/tealdef/scripts/react.d.tl:288
Notes
Internal id of a registered recipe.
Returns number
GetRecipeName<T>(Recipe<T>) : string base/tealdef/scripts/react.d.tl:289
for debugging, as name is not necessarily unique
Notes
Name a recipe was registered with (for debugging; names need not be unique).
Returns string
useState(?any) : ReactState base/tealdef/scripts/react.d.tl:291
Notes
Creates a state for the current node; the first render uses the initial value.
Returns ReactState
useState<T>(?T) : ReactStateT<T> base/tealdef/scripts/react.d.tl:292
Notes
Creates a state for the current node; the first render uses the initial value.
Returns ReactStateT<T>
useStateLazy<T>(function() : T) : ReactStateT<T> base/tealdef/scripts/react.d.tl:293
Notes
Like useState, but the initial value comes from a function called only on the first render.
Returns ReactStateT<T>
useMirrorState<T>(sourceRef : ReactRefT<T>) : ReactStateT<T> base/tealdef/scripts/react.d.tl:298
Create a State that is automatically updated when the source changes. Note: Mirroring a ref into a state allows you leverage state's auto-update. Otherwise, you might need to either read the ref in onStep, or make it a full-fledged State to force child updates.
Notes
Creates a state that follows a source ref or state and renders the recipe again when the source changes.
Returns ReactStateT<T>
useMirrorState<T>(sourceState : ReactStateT<T>) : ReactStateT<T> base/tealdef/scripts/react.d.tl:299
Notes
Creates a state that follows a source ref or state and renders the recipe again when the source changes.
Returns ReactStateT<T>
useDependentState<D, S>(sourceRef : ReactRefT<S>, transform : function(curDependent : D, source : S) : D) : ReactStateT<D> base/tealdef/scripts/react.d.tl:300
Notes
Creates a state that is recomputed with transform(current, source) whenever the source ref or state changes.
Returns ReactStateT<D>
useDependentState<D, S>(sourceState : ReactStateT<S>, transform : function(curDependent : D, source : S) : D) : ReactStateT<D> base/tealdef/scripts/react.d.tl:301
Notes
Creates a state that is recomputed with transform(current, source) whenever the source ref or state changes.
Returns ReactStateT<D>
onStep(function()) base/tealdef/scripts/react.d.tl:303
Notes
Registers a function called on every GUI step while the node exists.
onStepTimer(function(), intervalSeconds? : number, jitter? : boolean) base/tealdef/scripts/react.d.tl:304
jitter: true by default
Notes
Registers a function called at an interval (default 0.5 seconds); the call is deferred to after rendering.
| Parameter | Type | Description |
|---|---|---|
#1 |
function() |
|
intervalSeconds? |
number |
Interval in seconds. |
jitter? |
boolean |
Spread the calls of many nodes over time; true by default. |
onPausedChange(function(paused : boolean)) base/tealdef/scripts/react.d.tl:308
Act if step mode has changed (due to writing into useChildPauseModes()'s result) Normally only used by builtins, e.g. builtin.TabWidgetChild to pause steps of invisible tab content
note: current implementation calls this at least once even if mode did not change
Notes
Registers a function called when the node's step mode is paused or resumed (used by builtins such as tab widgets).
useChildPausedModes(paused : {integer : boolean}) : ReactRefWrapT<{integer : boolean}> base/tealdef/scripts/react.d.tl:309
Create a ref where you can store map childIndex->childPaused
Notes
Creates a ref that maps child index to paused, to pause the steps of hidden children.
Returns ReactRefWrapT<{integer : boolean}>
onEvent(filterForEventName : string, function(string, any)) base/tealdef/scripts/react.d.tl:311
Notes
Registers a handler for events with the given name sent with React.fireEvent.
| Parameter | Type | Description |
|---|---|---|
filterForEventName |
string |
Event name; must be the first argument. |
#2 |
function(string, any) |
useSelfRef() : ReactRefWrap base/tealdef/scripts/react.d.tl:313
Notes
Returns a node ref to the node of the current recipe.
Returns ReactRefWrap
useRef<T>(?T) : ReactRefT<T> base/tealdef/scripts/react.d.tl:315
Notes
Creates a ref (a value kept between renders) with an initial value.
Returns ReactRefT<T>
useRefLazy<T>(function() : T) : ReactRefT<T> base/tealdef/scripts/react.d.tl:316
Notes
Like useRef, but the initial value comes from a function called only on the first render.
Returns ReactRefT<T>
useMirrorRef<T>(ReactStateT<T>) : ReactRefT<T> base/tealdef/scripts/react.d.tl:318
Notes
Creates a ref that follows a source state or ref.
Returns ReactRefT<T>
useMirrorRef<T>(ReactRefT<T>) : ReactRefT<T> base/tealdef/scripts/react.d.tl:319
Notes
Creates a ref that follows a source state or ref.
Returns ReactRefT<T>
useDependentRef<D, S>(sourceRef : ReactRefT<S>, transform : function(curDependent : D, source : S) : D) : ReactRefT<D> base/tealdef/scripts/react.d.tl:320
Notes
Creates a ref that is recomputed with transform(current, source) whenever the source changes.
Returns ReactRefT<D>
useDependentRef<D, S>(sourceState : ReactStateT<S>, transform : function(curDependent : D, source : S) : D) : ReactRefT<D> base/tealdef/scripts/react.d.tl:321
Notes
Creates a ref that is recomputed with transform(current, source) whenever the source changes.
Returns ReactRefT<D>
useNodeRef() : ReactRefWrap base/tealdef/scripts/react.d.tl:323
Notes
Creates an empty node ref; pass it with React.ref(...) to a recipe call to get access to the created node.
Returns ReactRefWrap
Details
The recipe argument only selects the ref's type; the implementation ignores it.
Example
-- from base/content/game_mechanics/game_mechanics/notifications/gui/notification_button.tl
local toolButtonRef = react.useNodeRef(builtin.ToolButton)
react.useInputAction("selectNotifications", react.iaForward(toolButtonRef, "ACTION_CLICK"))
return builtin.ToolButton(react.ref(toolButtonRef), { ... })
useNodeRef<T>(Recipe<T>) : ReactRefWrapT<T> base/tealdef/scripts/react.d.tl:324
Notes
Creates an empty node ref; pass it with React.ref(...) to a recipe call to get access to the created node.
Returns ReactRefWrapT<T>
Details
The recipe argument only selects the ref's type; the implementation ignores it.
Example
-- from base/content/game_mechanics/game_mechanics/notifications/gui/notification_button.tl
local toolButtonRef = react.useNodeRef(builtin.ToolButton)
react.useInputAction("selectNotifications", react.iaForward(toolButtonRef, "ACTION_CLICK"))
return builtin.ToolButton(react.ref(toolButtonRef), { ... })
useNodeRef<T, Api>(RecipeWithApi<T, Api>) : ReactRefWrapApiT<T, Api> base/tealdef/scripts/react.d.tl:325
Notes
Creates an empty node ref; pass it with React.ref(...) to a recipe call to get access to the created node.
Returns ReactRefWrapApiT<T, Api>
Details
The recipe argument only selects the ref's type; the implementation ignores it.
Example
-- from base/content/game_mechanics/game_mechanics/notifications/gui/notification_button.tl
local toolButtonRef = react.useNodeRef(builtin.ToolButton)
react.useInputAction("selectNotifications", react.iaForward(toolButtonRef, "ACTION_CLICK"))
return builtin.ToolButton(react.ref(toolButtonRef), { ... })
useNodeRef<Api>(RecipeWithApi0<Api>) : ReactRefWrapApi0<Api> base/tealdef/scripts/react.d.tl:326
Notes
Creates an empty node ref; pass it with React.ref(...) to a recipe call to get access to the created node.
Returns ReactRefWrapApi0<Api>
Details
The recipe argument only selects the ref's type; the implementation ignores it.
Example
-- from base/content/game_mechanics/game_mechanics/notifications/gui/notification_button.tl
local toolButtonRef = react.useNodeRef(builtin.ToolButton)
react.useInputAction("selectNotifications", react.iaForward(toolButtonRef, "ACTION_CLICK"))
return builtin.ToolButton(react.ref(toolButtonRef), { ... })
ref<T, Api>(ReactRefWrapApiT<T, Api>) : RefFill base/tealdef/scripts/react.d.tl:328
Notes
Wraps one node ref (or a list of them) for passing as the first argument of a recipe call; the refs receive the created node.
Returns RefFill
ref<T>(ReactRefWrapT<T>) : RefFill base/tealdef/scripts/react.d.tl:329
Notes
Wraps one node ref (or a list of them) for passing as the first argument of a recipe call; the refs receive the created node.
Returns RefFill
ref<Api>(ReactRefWrapApi0<Api>) : RefFill base/tealdef/scripts/react.d.tl:330
Notes
Wraps one node ref (or a list of them) for passing as the first argument of a recipe call; the refs receive the created node.
Returns RefFill
ref(ReactRefWrap) : RefFill base/tealdef/scripts/react.d.tl:331
Notes
Wraps one node ref (or a list of them) for passing as the first argument of a recipe call; the refs receive the created node.
Returns RefFill
ref<T, Api>({ReactRefWrapApiT<T, Api>}) : RefFill base/tealdef/scripts/react.d.tl:333
Notes
Wraps one node ref (or a list of them) for passing as the first argument of a recipe call; the refs receive the created node.
Returns RefFill
ref<T>({ReactRefWrapT<T>}) : RefFill base/tealdef/scripts/react.d.tl:334
Notes
Wraps one node ref (or a list of them) for passing as the first argument of a recipe call; the refs receive the created node.
Returns RefFill
ref<Api>({ReactRefWrapApi0<Api>}) : RefFill base/tealdef/scripts/react.d.tl:335
Notes
Wraps one node ref (or a list of them) for passing as the first argument of a recipe call; the refs receive the created node.
Returns RefFill
ref({ReactRefWrap}) : RefFill base/tealdef/scripts/react.d.tl:336
Notes
Wraps one node ref (or a list of them) for passing as the first argument of a recipe call; the refs receive the created node.
Returns RefFill
findOldChildByLocalKey(string) : TreeNodeId base/tealdef/scripts/react.d.tl:338
Notes
Returns the child node of the previous render that had the given localKey.
Returns TreeNodeId
onMount(function(any)) base/tealdef/scripts/react.d.tl:340
Notes
Registers a function called when the node has been created.
onUnmount(function(any)) base/tealdef/scripts/react.d.tl:341
Notes
Registers a function called when the node is removed.
onMouseEvent(function(Gui.Mouse.Event) : boolean) base/tealdef/scripts/react.d.tl:342
Notes
Registers a mouse event listener for the node; return true if the event was handled.
onDragAndDrop(handlers : DragAndDropHandler) base/tealdef/scripts/react.d.tl:343
Notes
Makes the node a drag source and/or drop target with the given handlers.
style(ReactStyleParams) : ReactStyle base/tealdef/scripts/react.d.tl:345
Notes
Wraps style parameters for passing before the parameters of a recipe call; the base game sets classes with meta = { class = ... } instead.
Returns ReactStyle
useInputAction(string, IaHandler) base/tealdef/scripts/react.d.tl:357
Notes
Binds an input action (e.g. "IA_MENU_BACK") of the current node to a handler, a focus traversal or a forward.
useInputAction(string, IaForward) base/tealdef/scripts/react.d.tl:358
Notes
Binds an input action (e.g. "IA_MENU_BACK") of the current node to a handler, a focus traversal or a forward.
iaHandler(action : function(), isEnabled? : function() : (boolean | Gui.InputAction.InputActionState), buttonPromptTextOverride? : string, acceptRepeatedPresses? : boolean, isActive? : boolean) : IaHandler base/tealdef/scripts/react.d.tl:360
Notes
Creates an input action handler.
| Parameter | Type | Description |
|---|---|---|
action |
function() |
Called when the action fires. |
isEnabled? |
function() : (boolean | Gui.InputAction.InputActionState) |
Optional; returns a boolean or an input action state. |
buttonPromptTextOverride? |
string |
Optional text for the button prompt. |
acceptRepeatedPresses? |
boolean |
If true, the action repeats while the key is held. |
isActive? |
boolean |
Optional active flag. |
Returns IaHandler
iaHandlerExtended(action : function(Gui.InputAction.InvokeData), isEnabled? : function() : (boolean | Gui.InputAction.InputActionState), buttonPromptTextOverride? : string, isActive? : boolean) : IaHandler base/tealdef/scripts/react.d.tl:362
Notes
Like iaHandler, but the action receives the invoke data for every event, including key release.
Returns IaHandler
Details
The implementation tests an undefined variable before applying buttonPromptTextOverride, so the override has no effect.
iaForward(ReactRefWrap, ?string) : IaForward base/tealdef/scripts/react.d.tl:364
Notes
Forwards the input action to another node, optionally as a different action (e.g. "ACTION_CLICK").
Returns IaForward
iaForward<T>(ReactRefWrapT<T>, ?string) : IaForward base/tealdef/scripts/react.d.tl:365
Notes
Forwards the input action to another node, optionally as a different action (e.g. "ACTION_CLICK").
Returns IaForward
iaForward<T, Api>(ReactRefWrapApiT<T, Api>, ?string) : IaForward base/tealdef/scripts/react.d.tl:366
Notes
Forwards the input action to another node, optionally as a different action (e.g. "ACTION_CLICK").
Returns IaForward
iaForward<Api>(ReactRefWrapApi0<Api>, ?string) : IaForward base/tealdef/scripts/react.d.tl:367
Notes
Forwards the input action to another node, optionally as a different action (e.g. "ACTION_CLICK").
Returns IaForward
provideApi(any) base/tealdef/scripts/react.d.tl:369
Notes
Sets the API table of the current node; other recipes reach it with nodeRef:get():getApi().
useAction(rcRef : ReactRefWrapT<Builtin.RendererComponentParam>, actionFn? : (function() : TreeNodeId), key2? : string) : ReactRefWrap base/tealdef/scripts/react.d.tl:373
Deprecated, will be replaced by ToolStack. Returns selfRef that can be passed in setActiveOwner() useAction and setActiveOwner are for internal use only!
Notes
Binds an action function to a renderer component; deprecated in favour of the tool stack.
Returns ReactRefWrap: Self ref to pass to setActiveOwner.
useAction(rcRef : ReactRefWrapApiT<Builtin.RendererComponentParam, Builtin.RenderComponentAPI>, actionFn? : (function() : TreeNodeId), key2? : string) : ReactRefWrap base/tealdef/scripts/react.d.tl:374
Notes
Binds an action function to a renderer component; deprecated in favour of the tool stack.
Returns ReactRefWrap: Self ref to pass to setActiveOwner.
setActiveOwner(actionUser : ReactRefWrap) base/tealdef/scripts/react.d.tl:375
Notes
Internal; makes the action of useAction active.
setDisableFocusable(boolean) base/tealdef/scripts/react.d.tl:377
Notes
Makes the current node non-focusable.
setForceFocusable(boolean) base/tealdef/scripts/react.d.tl:378
Notes
Makes the current node focusable.
setIndicateSelectionWithMouseHoverOnly(boolean) base/tealdef/scripts/react.d.tl:379
Notes
Shows the selection highlight of the current node only on mouse hover.
setRestrictMouseFocus(boolean) base/tealdef/scripts/react.d.tl:380
Notes
Sets the restrict-mouse-focus flag of the current node.
setMouseTransparent(boolean) base/tealdef/scripts/react.d.tl:381
Notes
Lets mouse events pass through the current node.
setLightweight(boolean) base/tealdef/scripts/react.d.tl:382
Notes
Marks the current node as lightweight.
Details
The implementation always sets the flag to true, whatever the argument.
setClipContent(boolean) base/tealdef/scripts/react.d.tl:383
use with care: special animation cases only, otherwise it might mess with the "natural" gui behaviour
setStyleClasses(string, string...) base/tealdef/scripts/react.d.tl:384
Notes
Sets the style classes of the current node (joined with commas).
setPreferredFocusChild<T, Api>(ReactRefWrapApiT<T, Api>) base/tealdef/scripts/react.d.tl:386
Notes
Sets the child that gets the focus when the current node receives it.
setPreferredFocusChild<T>(ReactRefWrapT<T>) base/tealdef/scripts/react.d.tl:387
Notes
Sets the child that gets the focus when the current node receives it.
setPreferredFocusChild<Api>(ReactRefWrapApi0<Api>) base/tealdef/scripts/react.d.tl:388
Notes
Sets the child that gets the focus when the current node receives it.
setPreferredFocusChild(ReactRefWrap) base/tealdef/scripts/react.d.tl:389
Notes
Sets the child that gets the focus when the current node receives it.
iaFocusTraversal(horizontal : boolean, forward : boolean, allowBubbleUp? : boolean) : IaHandler base/tealdef/scripts/react.d.tl:391
Notes
Creates an input action that moves the focus to the next or previous node.
| Parameter | Type | Description |
|---|---|---|
horizontal |
boolean |
Move horizontally (true) or vertically (false). |
forward |
boolean |
Move right/down (true) or left/up (false). |
allowBubbleUp? |
boolean |
Let the parent handle the action at the end of the list. |
Returns IaHandler
fireEvent(source : ReactRefWrap, name : string, param? : any) base/tealdef/scripts/react.d.tl:393
Notes
Sends an event with a name and an optional parameter; recipes receive it with React.onEvent.
| Parameter | Type | Description |
|---|---|---|
source |
ReactRefWrap |
Node the event starts from; the base game passes nil for GUI-wide events such as "PushTool". |
name |
string |
|
param? |
any |
fireEvent<T>(source : ReactRefWrapT<T>, name : string, param? : any) base/tealdef/scripts/react.d.tl:394
Notes
Sends an event with a name and an optional parameter; recipes receive it with React.onEvent.
| Parameter | Type | Description |
|---|---|---|
source |
ReactRefWrapT<T> |
Node the event starts from; the base game passes nil for GUI-wide events such as "PushTool". |
name |
string |
|
param? |
any |
fireEvent<T, Api>(source : ReactRefWrapApiT<T, Api>, name : string, param? : any) base/tealdef/scripts/react.d.tl:395
Notes
Sends an event with a name and an optional parameter; recipes receive it with React.onEvent.
| Parameter | Type | Description |
|---|---|---|
source |
ReactRefWrapApiT<T, Api> |
Node the event starts from; the base game passes nil for GUI-wide events such as "PushTool". |
name |
string |
|
param? |
any |
getCurrentRecipeName() : string base/tealdef/scripts/react.d.tl:397
Notes
Name of the recipe being rendered.
Returns string
getCurrentRecipeId() : integer base/tealdef/scripts/react.d.tl:398
Notes
Id of the recipe being rendered.
Returns integer
enqueueDeferredStep(fn : function(), debugScope : string) base/tealdef/scripts/react.d.tl:400
call this function with restricted api, in parallel to rendering preparations
enqueueJoin(fn : function(), debugScope : string) base/tealdef/scripts/react.d.tl:401
call this function on main thread after all parallelized react things are complete
enqueueParallel<ParamT>(useFnName : string, useFnParams : ParamT, join : function(workItemResult : any, useFnParams : ParamT)) base/tealdef/scripts/react.d.tl:402
computes result in another thread via useFn(useFnName)(...) and applies it via enqueueJoin(result, ...)
React.IaHandler¶
record base/tealdef/scripts/react.d.tl:347
record IaHandler
Notes
Input action handler created with React.iaHandler or React.iaHandlerExtended.
Used in the base game: 1 time in 1 file
base/content/gui/gui/statistics/statistics_react_util.tl:84
Fields
Functions
handlerFn(Gui.InputAction.InvokeData) base/tealdef/scripts/react.d.tl:348
note: invokeData is nil if acceptRepeatedPresses == true
isEnabledFn() : boolean base/tealdef/scripts/react.d.tl:349
Notes
Returns whether the action is enabled; a boolean result is converted to Enabled or Inactive.
Returns boolean
React.IaForward¶
record base/tealdef/scripts/react.d.tl:353
record IaForward
Notes
Forwarding of an input action to another node, created with React.iaForward.
ReactPluginDesc¶
record global base/tealdef/scripts/react.d.tl:405
global record ReactPluginDesc
Notes
data of a "react-plugin <extension point id>" generic resource.
Fields
| Name | Type | Description |
|---|---|---|
filePath |
ResName |
The plugin recipe as "file.script@RecipeName". |
condition |
ResName |
Optional function reference ("file.script@fn") that decides whether the plugin is shown. |
order |
number |
Sort key; plugins are created in ascending order (default 0). |
ReactPlugin0¶
record global base/tealdef/scripts/react.d.tl:411
global record ReactPlugin0
Notes
A loaded plugin of an extension point without parameters.
Fields
| Name | Type | Description |
|---|---|---|
recipe |
Recipe0 |
The plugin recipe. |
order |
number |
Sort key. |
Functions
condition() : boolean base/tealdef/scripts/react.d.tl:414
Notes
Optional; the plugin is created only if it returns true.
Returns boolean
ReactPlugin¶
record global base/tealdef/scripts/react.d.tl:416
global record ReactPlugin<RecipeParam>
Notes
A loaded plugin of an extension point with parameters.
Fields
| Name | Type | Description |
|---|---|---|
recipe |
Recipe<RecipeParam> |
The plugin recipe. |
order |
number |
Sort key. |
Functions
condition(RecipeParam) : boolean base/tealdef/scripts/react.d.tl:419
Notes
Optional; the plugin is created only if it returns true for the parameters.
Returns boolean
ReactReplacementApi¶
record global base/tealdef/scripts/react.d.tl:422
global record ReactReplacementApi
Notes
API given to a replacement config's doReplaceFn.
Functions
ReplaceRecipe<RecipeType>(originalRecipe : RecipeType, replacement : RecipeType) base/tealdef/scripts/react.d.tl:425
delegate all calls to the original recipe to the replacement Remember that the replacement must be fully compatible, e.g. if the original provides an Api, the replacement must provide the same one!
ReactReplacementConfigDesc¶
record global base/tealdef/scripts/react.d.tl:428
global record ReactReplacementConfigDesc
Notes
data of a "react-replacement-config" generic resource, which replaces GUI recipes before the GUI starts.
Example
Fields
| Name | Type | Description |
|---|---|---|
filePath |
ResName |
Script file that contains doReplaceFn, without the @function part. |
doReplaceFn |
string |
name of the function in the above .script.tl |
order |
number |
Sort key; configs run in ascending order (default 0). |
ReactReplacementConfig¶
record global base/tealdef/scripts/react.d.tl:434
global record ReactReplacementConfig
Notes
A loaded replacement config.
Fields
| Name | Type | Description |
|---|---|---|
order |
number |
Sort key. |
Functions
doReplaceFn(replacementApi : ReactReplacementApi) base/tealdef/scripts/react.d.tl:436
the function that actually triggers the replacement (takes a callback to tell react what to exactly replace)