{"id":15504466,"url":"https://github.com/kwonoj/emscripten-wasm-loader","last_synced_at":"2025-04-23T00:09:52.740Z","repository":{"id":25213783,"uuid":"103465935","full_name":"kwonoj/emscripten-wasm-loader","owner":"kwonoj","description":null,"archived":false,"fork":false,"pushed_at":"2022-02-11T19:07:56.000Z","size":728,"stargazers_count":9,"open_issues_count":1,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-19T18:30:02.440Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kwonoj.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-14T00:33:57.000Z","updated_at":"2024-04-14T18:46:30.000Z","dependencies_parsed_at":"2022-08-07T11:15:27.237Z","dependency_job_id":null,"html_url":"https://github.com/kwonoj/emscripten-wasm-loader","commit_stats":null,"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kwonoj%2Femscripten-wasm-loader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kwonoj%2Femscripten-wasm-loader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kwonoj%2Femscripten-wasm-loader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kwonoj%2Femscripten-wasm-loader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kwonoj","download_url":"https://codeload.github.com/kwonoj/emscripten-wasm-loader/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249906767,"owners_count":21343499,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-02T09:18:10.549Z","updated_at":"2025-04-23T00:09:52.712Z","avatar_url":"https://github.com/kwonoj.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/kwonoj/emscripten-wasm-loader.svg?branch=master)](https://travis-ci.org/kwonoj/emscripten-wasm-loader)\r\n[![Build status](https://ci.appveyor.com/api/projects/status/la7qsyfmoekernj7/branch/master?svg=true)](https://ci.appveyor.com/project/kwonoj/emscripten-wasm-loader/branch/master)\r\n[![codecov](https://codecov.io/gh/kwonoj/emscripten-wasm-loader/branch/master/graph/badge.svg)](https://codecov.io/gh/kwonoj/emscripten-wasm-loader)\r\n[![npm](https://img.shields.io/npm/v/emscripten-wasm-loader.svg)](https://www.npmjs.com/package/emscripten-wasm-loader)\r\n\r\n# Emscripten-wasm-loader\r\n\r\nWraps 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`.\r\n\r\n# Usage\r\n\r\n```js\r\nimport { getModuleLoader } from 'emscripten-wasm-loader';\r\n\r\nconst loader = getModuleLoader(factoryLoader, require('wasm/wasmlibaray'), { additional: ''});\r\n```\r\n\r\n`getModuleLoader` is higher order function returns actual module loader.\r\n\r\n```js\r\ngetModuleLoader\u003cT, R extends AsmRuntimeType\u003e(\r\n  factoryLoader: (runtime: R) =\u003e T,\r\n  runtimeModule: runtimeModuleType,\r\n  module?: Record\u003cstring, any\u003e\r\n) =\u003e moduleLoaderType\u003cT\u003e;\r\n\r\n/**\r\n * Asynchronously load and initialize asm module.\r\n *\r\n * @returns {T} Factory function manages lifecycle of hunspell and virtual files.\r\n */\r\ntype moduleLoaderType\u003cT\u003e = () =\u003e Promise\u003cT\u003e;\r\n```\r\n\r\n`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`.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkwonoj%2Femscripten-wasm-loader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkwonoj%2Femscripten-wasm-loader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkwonoj%2Femscripten-wasm-loader/lists"}