Home > Engineering > Substrate > Bare Runtime > Global API
Bare Global API
The Bare global is available without import. There
is no process or Buffer global — those require
explicit modules.
Properties
Bare.platform—"linux","darwin","win32","android","ios"Bare.arch—"x64","arm64","arm","ia32","mips","mipsel","riscv64"Bare.simulator— boolean, true if compiled for simulatorBare.argv— command line argumentsBare.pid— process IDBare.exitCode— exit code (used ifexit()called without argument)Bare.version— version stringBare.versions— object with dependency versionsBare.suspended— boolean, current suspension stateBare.exiting— boolean, whether process is exiting
Methods
Bare.exit([code])— immediately terminateBare.suspend([linger])— suspend process and all threads (mobile lifecycle)Bare.wakeup([deadline])— wake during suspension for limited workBare.idle()— immediately suspend event loopBare.resume()— resume after suspension
Events
uncaughtException— unhandled JS exceptionunhandledRejection— unhandled promise rejectionbeforeExit— loop out of work, chance to schedule moreexit— process exiting (must not schedule work)suspend— process suspending (defer/cancel work)wakeup— waking during suspensionidle— idle after suspension (loop will block)resume— resuming (restart deferred work)
Sub-namespaces
Bare.Thread
Lightweight threads with synchronous joins and SharedArrayBuffer support.
Bare.Thread.isMainThread— booleanBare.Thread.self— current thread referencenew Bare.Thread(filename[, options])— spawnthread.join()— synchronous waitthread.suspend()/thread.resume()/thread.terminate()
Bare.Addon
Native addon loading.
Bare.Addon.resolve(specifier)— resolve pathBare.Addon.load(specifier)— load addonBare.Addon.host— platform-arch stringBare.Addon.cache— loaded addon cache
Bare.IPC
Optional streaming communication with embedder. Returns a Duplex stream or null if not embedded.
Source: https://github.com/holepunchto/bare and https://docs.pears.com/reference/api.html