Exemplo n.º 1
0
  teardown() {
    if (BROADCAST_CHANNEL_SUPPORT) {
      this.client.disconnect();
    }
    this.rawWorker.terminate();

    this.view.setActive(false);
  }
Exemplo n.º 2
0
  main() {
    this.view.setActive(true);

    var threadClient = null;
    if (BROADCAST_CHANNEL_SUPPORT) {
      threads.manager({
        'message-service': {
          src: 'workers/message-service.js',
          type: 'worker'
        }
      });

      threadClient = threads.client('message-service');
    }

    this.client = threadClient;
    this.rawWorker = new Worker('workers/message-worker.js');
    this.channel = BROADCAST_CHANNEL_SUPPORT ? new window.BroadcastChannel('message') : {};

    // Start benchmarking.
    this.init();
  }