Skip to content

remote.Function.registerMountHandler

github-actions[bot] edited this page Jun 8, 2026 · 2 revisions

@zenstone/ts-utils / remote / registerMountHandler

Function: registerMountHandler()

registerMountHandler<K>(type, handler): void

Defined in: src/remote/mountRemote.ts:115

注册挂载类型处理器

Type Parameters

K

K extends keyof MountHandlerMap

Parameters

type

K

资源类型标识

handler

MountHandlerMap[K]

处理函数

Returns

void

Example

registerMountHandler('wasm', async (ctx, opts) => {
  const response = await fetch(opts.url);
  const module = await WebAssembly.instantiateStreaming(response, opts.importObject);
  return { type: ctx.type, scope: ctx.scope, url: opts.url, module };
});

Clone this wiki locally