MCPcopy Create free account
hub / github.com/apitable/apitable / makeMutClosure

Function makeMutClosure

packages/databus-wasm-nodejs/cjs/databus_wasm.js:195–218  ·  view source on GitHub ↗
(arg0, arg1, dtor, f)

Source from the content-addressed store, hash-verified

193}
194
195function makeMutClosure(arg0, arg1, dtor, f) {
196 const state = { a: arg0, b: arg1, cnt: 1, dtor };
197 const real = (...args) => {
198 // First up with a closure we increment the internal reference
199 // count. This ensures that the Rust closure environment won't
200 // be deallocated while we're invoking it.
201 state.cnt++;
202 const a = state.a;
203 state.a = 0;
204 try {
205 return f(a, state.b, ...args);
206 } finally {
207 if (--state.cnt === 0) {
208 wasm.__wbindgen_export_2.get(state.dtor)(a, state.b);
209
210 } else {
211 state.a = a;
212 }
213 }
214 };
215 real.original = state;
216
217 return real;
218}
219function __wbg_adapter_30(arg0, arg1, arg2) {
220 wasm.wasm_bindgen__convert__closures__invoke1_mut__h1c96eaa25d150746(arg0, arg1, addHeapObject(arg2));
221}

Callers 1

databus_wasm.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected