How to use the iframe-coordinator/WorkerClient function in iframe-coordinator

To help you get started, we’ve selected a few iframe-coordinator examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github purecloudlabs / iframe-coordinator / demo-app / src / workers / failure-worker.js View on Github external
// This worker is designed to showcase worker error rate handling.
import WorkerClient from "iframe-coordinator/WorkerClient";

const client = new WorkerClient(() => {
  // Shutdown requested from host.  Clean-up; WorkerClient will ack
  if (currTimeout) {
    clearTimeout(currTimeout);
    currTimeout = null;
  }
});

let currTimeout = setTimeout(triggerError, getTimeout());

function triggerError() {
  // Setup the next error call, since the error will stop this function execution
  currTimeout = setTimeout(triggerError, getTimeout());

  console.error('Triggering an intentional error from a worker.  Will not pop rate limit');
  foo.bar.baz();
}
github purecloudlabs / iframe-coordinator / demo-app / src / workers / demo-worker.js View on Github external
import WorkerClient from "iframe-coordinator/WorkerClient";

const client = new WorkerClient(() => {
  // Shutdown requested from host.  Clean-up; WorkerClient will ack
  if (currTimeout) {
    clearTimeout(currTimeout);
    currTimeout = null;
  }

  // Not strictly necessary, but a good practice
  client.unsubscribe('host.topic');
});

// Routing example
// client.requestNavigation('/wikipedia');

// Pub-Sub Example
client.subscribe('host.topic');
client.onPubsub(publication => {

iframe-coordinator

Tools for coordinating embedded apps via iframes.

MIT
Latest version published 20 days ago

Package Health Score

73 / 100
Full package analysis

Similar packages