deferredCloseWebFunction static method

void deferredCloseWebFunction(
  1. NitroWasmModule module,
  2. int? oldFnPtr
)

Web analog of the native deferred NativeCallable.close: releases a replaced callback's function-table slot on the next microtask, after the bridge call that switched native over to the new slot has returned.

Implementation

static void deferredCloseWebFunction(NitroWasmModule module, int? oldFnPtr) {
  if (oldFnPtr == null || oldFnPtr == 0) return;
  scheduleMicrotask(() => module.removeFunction(oldFnPtr));
}