Repository
Current version released
7 months ago
SOCKET.ionic
Parent
import { getParentWorker } from 'https://deno.land/x/worker_ionic/mod.ts';
// load worker
const worker = getParentWorker(new URL('./worker.ts', import.meta.url).href)
// listen to worker events
const event = worker.on('ping', (data) => {
console.log(data)
})
// remove event listener
worker.remove('ping', event);
// emit to worker
worker.emit('channel', { potatoes: 'smashed' });
Child
import { getChildWorker } from 'https://deno.land/x/worker_ionic/mod.ts';
const worker = getChildWorker();
// listen to parent events
const event = worker.on('ping', (data) => {
console.log(data)
})
// remove event listener
worker.remove('ping', event);
// emit to parent
worker.emit('channel', { potatoes: 'smashed' });