MCPcopy Create free account
hub / github.com/dylan-sutton-chavez/edge-python / injectEvent

Function injectEvent

runtime/worker/engine.js:250–258  ·  view source on GitHub ↗
(message)

Source from the content-addressed store, hash-verified

248
249/* Inject directly into the paused VM. Returns false if the VM isn't ready yet (no compilerExports, or no paused run) so callers can buffer. */
250function injectEvent(message) {
251 if (!compilerExports) return false;
252 const bytes = TE.encode(message);
253 const ptr = compilerExports.wasm_alloc(bytes.length);
254 new Uint8Array(compilerExports.memory.buffer, ptr, bytes.length).set(bytes);
255 const status = compilerExports.run_push_event(ptr, bytes.length);
256 compilerExports.wasm_free(ptr, bytes.length);
257 return status === 0;
258}
259
260/* Push a string into the VM's event queue; wakes `receive()`. Buffers if the VM isn't paused on PENDING_EVENT yet, the driver loop drains the buffer at the next yield, so callers never need to know about the VM's readiness window. */
261export function pushEvent(message) {

Callers 2

runFunction · 0.85
pushEventFunction · 0.85

Calls 1

setMethod · 0.80

Tested by

no test coverage detected