Future

The 'future' module provides a type that wraps around the Vortex built-in __future__ functionality

Function Signatures

/*
    Wraps the __future__ functionality in an easy to use object.
    func: the function to run in another thread
    default: the default value to return if the real value isn't ready
*/

type Future = (func: Function, default: Any = None) => {
    // The value of the async function
    value: Any,
    // If the value is ready
    ready: Boolean,
    // If the async function has finished
    finished: Boolean,
    // Checks if the value is ready
    is_ready: () => Boolean,
    // Returns value if ready, else returns the default [Non-blocking]
    get: () => Any,
    // Waits for the value to be ready, then returns it [Blocking]
    wait_for: () => Any
}

Last updated