Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

emscripten-wasm-loader

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

emscripten-wasm-loader

Common interface to load wasm module into isomorphic environment

  • 3.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
15K
increased by15.26%
Maintainers
1
Weekly downloads
 
Created
Source

Build Status Build status codecov npm

Emscripten-wasm-loader

Wraps up common initialization logic with predefined preprocessor object. This module intended to support specific scoped usecase for wasm binary built with MODULARIZED and SINGLE_FILE.

Usage

import { getModuleLoader } from 'emscripten-wasm-loader';

const loader = getModuleLoader(factoryLoader, require('wasm/wasmlibaray'), { additional: ''});

getModuleLoader is higher order function returns actual module loader.

getModuleLoader<T, R extends AsmRuntimeType>(
  factoryLoader: (runtime: R) => T,
  runtimeModule: runtimeModuleType,
  module?: Record<string, any>
) => moduleLoaderType<T>;

/**
 * Asynchronously load and initialize asm module.
 *
 * @returns {T} Factory function manages lifecycle of hunspell and virtual files.
 */
type moduleLoaderType<T> = () => Promise<T>;

factoryLoader is callback function to be called to create actual instance of module using initialized wasm binary runtime for customized init steps for each consumer. runtimeModule is function loaded via require to emscripten preamble js for wasm binaries. It expects wasm binary should be built with MODULARIZE=1 with SINGLE_FILE=1 option. Lastly module is object to be inherited when execute runtimeModule. Emscripten's modularized preamble construct scoped wasm runtime module named Module, allows to have predefined object if needed. Internally getModuleLoader augments given object and set default interfaces like initializeRuntime.

FAQs

Package last updated on 19 Jul 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc