Vortex Docs
  • Introduction
  • Getting Started
  • Language Reference
    • Core Functionality
    • Built-in Functions
    • Hooks
    • C Interoperability
    • Coroutines
    • Decorators
    • Type Hinting
    • Error Handling
  • Examples
    • Data Structures
    • Hooks
    • Fetching Data
    • Sockets
    • Event Bus
  • Standard Modules
    • Functional
    • Functools
    • Future
    • I/O
    • JSON
    • Logging
    • Math
    • OS
    • Random
    • Requests
    • SDL
    • SQLite
    • String
    • Sys
    • Time
    • Crypto
    • Websockets
  • Development Roadmap
Powered by GitBook
On this page
  1. Standard Modules

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
}
PreviousFunctoolsNextI/O

Last updated 1 year ago