[][src]Module rask_wasm::entries

This module contains the entry points callable from JavaScript.

Usage

To initialize the memory correctly, the exports have to be called in the following order:

  1. exports.__wasm_init_memory()
  2. exports.__wasm_init_tls()
  3. exports.init() Only now other functions may get called. Calling 1-3 more than once is undefined behavior. When executing init() a message is sent to the main thread, signaling the initialization has finished. This signal is used to start the graphics worker.

Functions

draw_frame

This function is called to render each frame. Most of the communication with the graphics API is done through calling JS functions.

run_logic

Initialize the game state, communicate with the graphics worker and set up networking. This function is being exposed to JavaScript.

run_pool

This function serves as the entry point for threadpool workers