Skip to content

Latest commit

 

History

History
76 lines (45 loc) · 2.6 KB

File metadata and controls

76 lines (45 loc) · 2.6 KB

Table of Contents

prepare

index.js:16-18

Prepares a binary by injecting getter and setter function for memory, globals and tables.

Parameters

  • binary ArrayBuffer a wasm binary
  • include Object (optional, default {memory:true,table:true})
    • include.memory Boolean whether or not to include memory (optional, default true)
    • include.table Boolean whether or not to include the function table (optional, default true)
    • include.globals Array<Boolean> whether or not to include a given global. Each index in the array stands for a global index. Indexes that are set to false or left undefined will not be persisted. By default all globals are persisted. (optional, default Array.<true>)
  • symbol String a string used to prefix the injected setter and getter functions (optional, default '_')

Returns ArrayBuffer the resulting wasm binary

hibernate

index.js:27-64

Given a Webassembly Instance this will produce an Object containing the current state of the instance

Parameters

  • instance Webassembly.Instance
  • symbol String the symbol that will be used to find the injected functions (optional, default '_')

Returns Object the state of the wasm instance

resume

index.js:72-102

Resumes a previously hibernated Webassembly instance

Parameters

  • instance WebAssembly.Instance
  • state Object the previous state of the wasm instance

Returns WebAssembly.Instance