YYC_Task

constructor

new YYC_Task(_func[, _arg])

Description

A task.

Arguments

Name Type Description
_func func A function executed by the task. It will be passed _arg as the first argument and the task instance as the second.
_arg any An optional argument for the task function. Defaults to undefined.

Properties

Name Description
Arg An argument for the task function.
Func A function executed by the task.
Parent The parent of the task.

Methods

Name Description
Run Enqueues the task for execution.

Example

Creates a task that sleeps for 1 second and then prints a message.

// Create event
new YYC_Task(function (_ms) {
    var _t = current_time;
    while (current_time - _t < _ms) {}
    show_debug_message("Slept for " + string(_ms) + "ms!");
}, 1000).Run();

// Step event
if (!yyc_is_boost())
{
    yyc_tasks_update();
}

See also

YYC_GroupTask, yyc_tasks_update

Do you find this page helpful?

Copyright © 2021, Patrik Kraif. Built on October 14, 2021 using GMDoc.