ISDKUtils addon SDK interface
The ISDKUtils
interface provides general APIs intended for use with the Addon SDK. It is normally accessed via runtime.sdk
.
ISDKUtils APIs
- addLoadPromise(promise)
- Only valid while the project is still loading. Add a promise that the runtime will wait to resolve before starting the first layout. This is useful if you want to make sure your addon loads an asynchronous resource before the game starts.
- sendWrapperExtensionMessage(wrapperComponentId, messageId, params)
- sendWrapperExtensionMessageAsync(wrapperComponentId, messageId, params)
- These methods are equivalent to those in ISDKInstanceBase, but allow specifying an arbitrary wrapper component ID. In general it is recommended to use the instance-specific methods as cases where you need to message a different wrapper extension to your own are rare.
- isAutoSuspendEnabled
- Set or get a boolean indicating whether the runtime automatically suspends when it detects the page or app going in to the background. This is enabled by default; by turning it off you can then use
setSuspended()
to control when the runtime suspends and resumes. Note however that even if automatic suspending is disabled, browsers may effectively suspend background pages anyway through other means, such as throttling timers and callbacks. Therefore disabling automatic suspending does not necessarily mean the runtime actually is able to continue running in the background. This API exists mainly to comply with the requirements of platforms that provide their own suspend and resume events that are required to be used.
- setSuspended(isSuspended)
- Pass
true
to suspend the runtime, and false
to resume it. When suspended, the runtime stops ticking and drawing anything, and remains inactive. Make sure that suspend and resume calls are paired one-to-one: for example do not suspend once but resume twice.
- createLoopingConditionContext(loopName)
- This method is intended specifically for looping conditions (where
"isLooping": true
is specified in the condition definition). It allows "retriggering" the event, which executes all subsequent conditions, actions and sub-events in one call; a loop is implemented by repeatedly retriggering the event. The loop name is optional but allows passing the name to the system loopindex condition to retrieve the index in nested loops. It returns an ILoopingConditionContext. An example looping condition implementation is shown below.
// Sample looping condition method
TestLoop(count)
{
const loopCtx = this.runtime.sdk.createLoopingConditionContext();
for(let i = 0; i < count; ++i)
{
loopCtx.retrigger();
if (loopCtx.isStopped)
break;
}
loopCtx.release();
}
Construct Animate Manual
Construct.net
2024-09-17
2024-09-18
You are here:
Search this manual:
This manual entry was last updated on 18 Sep, 2024 at 10:40