How to use the pubsub-js.immediateExceptions function in pubsub-js

To help you get started, we’ve selected a few pubsub-js 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 mozilla / testpilot / addon / src / bootstrap.js View on Github external
/* global APP_STARTUP */

import PubSub from "pubsub-js";

import { debug, log, setAddonMetadata } from "./lib/utils";
import { startupDone, startupPromise, startupObserver } from "./lib/appStartup";
import { startupPrefsObserver, shutdownPrefsObserver } from "./lib/prefs";
import { startupFrameScripts, shutdownFrameScripts } from "./lib/frameScripts";
import { startupWebExtension, shutdownWebExtension } from "./lib/webExtension";
import { startupEvents, shutdownEvents } from "./lib/events";
import { startupChannels, shutdownChannels } from "./lib/channels";
import { startupTelemetry, shutdownTelemetry } from "./lib/telemetry";
import { startupAddonManager, shutdownAddonManager } from "./lib/addonManager";

PubSub.immediateExceptions = true;

export function startup(data, reason) {
  setAddonMetadata(data);

  if (reason === APP_STARTUP) {
    startupObserver.register();
  } else {
    startupDone();
  }

  return startupPromise
    .then(setupDebug)
    .then(() => startupTelemetry(data, reason))
    .then(startupAddonManager)
    .then(startupPrefsObserver)
    .then(startupEvents)
github mozilla / testpilot / addon / src / webextension / background.js View on Github external
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

/* global browser */

import PubSub from "pubsub-js";

import { log, debug } from "./lib/utils";
import { setupStorage } from "./lib/storage";
import { setupEnvironment } from "./lib/environments";
import { setupBrowserAction } from "./lib/browserAction";
import { setupMetrics } from "./lib/metrics";
import { setupBootstrapPort, sendBootstrapMessage } from "./lib/bootstrap";

PubSub.immediateExceptions = true;

function setup() {
  setupDebug()
    .then(setupStorage)
    .then(setupBrowserAction)
    .then(setupMetrics)
    .then(setupEnvironment)
    .then(setupBootstrapPort)
    .then(() => sendBootstrapMessage("ready"))
    .catch(err => log("init error", err));
}

async function setupDebug() {
  if (!debug) return;
  ["bootstrap", "webExtension"].forEach(root =>
    PubSub.subscribe(root, (message, data) => log("pubsub", message, data))
github dailymuse / mithril-coat / src / index.js View on Github external
var util = require("./util"),
    views = require("./views"),
    controllers = require("./controllers"),
    modules = require("./modules"),
    model = require("./model"),
    router = require("./router"),
    mithril = require("mithril"),
    PubSub = require("pubsub-js");

var VERSION = "0.2.1";

options = {}

// only to see pubsub events
PubSub.immediateExceptions = true;

module.exports = {
    // Versioning info
    version: VERSION,

    // Utils
    map: util.map,
    deparam: util.deparam,

    // Views
    View: views.View,
    TemplatedView: views.TemplatedView,

    // Controllers
    Controller: controllers.Controller,
github dailymuse / mithril-coat / build / coat.js View on Github external
},{"mithril":1,"pubsub-js":2}],4:[function(require,module,exports){
var util = require("./util"),
    views = require("./views"),
    controllers = require("./controllers"),
    modules = require("./modules"),
    model = require("./model"),
    router = require("./router"),
    mithril = require("mithril"),
    PubSub = require("pubsub-js");

var VERSION = "0.2.1";

options = {}

// only to see pubsub events
PubSub.immediateExceptions = true;

module.exports = {
    // Versioning info
    version: VERSION,

    // Utils
    map: util.map,
    deparam: util.deparam,

    // Views
    View: views.View,
    TemplatedView: views.TemplatedView,

    // Controllers
    Controller: controllers.Controller,
github daniel-j / webjcs / src / js / vent.js View on Github external
const PubSub = require('pubsub-js')
PubSub.immediateExceptions = true

PubSub.publish = PubSub.publishSync

module.exports = PubSub