Module crit.context

Switch between script contexts.

Functions

run_as (msg_id, f) Schedule a function to run in the context of another script.
as (msg_id, f) Wrap a function so that it runs in another script’s context.
handle (message_id, message_id) Handle incoming run_as() requests.


Functions

run_as (msg_id, f)
Schedule a function to run in the context of another script.

For this to work, the script being targeted must call handle() in its on_message().

Parameters:

  • msg_id url, hash or string URL to the script in which to run the function.
  • f function The function to run in another context.
as (msg_id, f)
Wrap a function so that it runs in another script’s context.

For this to work, the script being targeted must call handle() in its on_message().

Parameters:

  • msg_id url, hash or string URL to the script in which to run the function.
  • f function The function to run in another context.

Returns:

    function The wrapped function. When called, it will schedule f to run in the target script’s context. Arguments are passed through to f, but any return values are lost (since run_as() doesn’t actually call the function synchroneously).
handle (message_id, message_id)
Handle incoming run_as() requests.

For this module to work, you need to call this in on_message() in any script that might be targeted by run_as().

Parameters:

generated by LDoc 1.4.6 Last updated 2022-05-04 10:01:11