How to use the rsvp.rethrow function in rsvp

To help you get started, we’ve selected a few rsvp 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 tildeio / oasis.js / test / xhr_tests.js View on Github external
test("listeners are invoked on load", function() {
  stop();
  expect(1);

  oasis.on('xhr.load', function () {
    start();
    ok(true, 'load listener was called');
  });

  oasis.xhr('/fixtures/index.js')['catch'](RSVP.rethrow);
});
github tildeio / oasis.js / test / xhr_tests.js View on Github external
test("listeners are invoked on send", function() {
  expect(1);
  stop(2);

  oasis.on('xhr.send', function () {
    start();
    ok(true, 'send listener was called');
  });

  oasis.xhr('/fixtures/index.js').then(function () {
    start();
  })['catch'](RSVP.rethrow);
});
github tildeio / oasis.js / lib / oasis / inline_adapter.js View on Github external
fetchResource: function (url, oasis) {
    var adapter = this;

    return xhr(url, {
      dataType: 'text'
    }, oasis).then(function (code) {
      return adapter.wrapResource(code);
    })['catch'](RSVP.rethrow);
  },
github tildeio / oasis.js / lib / oasis / sandbox.js View on Github external
connectPorts: function () {
    var sandbox = this;

    var allSandboxPortPromises = a_reduce.call(this._capabilitiesToConnect, function (accumulator, capability) {
      return accumulator.concat(sandbox.sandboxPortDefereds[capability].promise);
    }, []);

    RSVP.all(allSandboxPortPromises).then(function (ports) {
      Logger.log("container: All " + ports.length + " ports created.  Transferring them.");
      sandbox.adapter.connectPorts(sandbox, ports);
    })['catch'](RSVP.rethrow);
  },
github tildeio / oasis.js / lib / oasis / inline_adapter.js View on Github external
didConnect: function(oasis) {
    var adapter = this;

    return oasis.sandbox._waitForLoadDeferred().resolve(loadSandboxJS()['catch'](RSVP.rethrow));

    function applySandboxJS(sandboxFn) {
      Logger.log("sandbox: inline sandbox initialized");
      sandboxFn(oasis);
      return oasis.sandbox;
    }

    function loadSandboxJS() {
      return new RSVP.Promise(function (resolve, reject) {
        resolve(adapter.fetchResource(oasis.sandbox.options.url, oasis).
          then(applySandboxJS));
      });
    }
  },
});
github tildeio / oasis.js / lib / oasis / connect.js View on Github external
export function registerHandler(oasis, capability, options) {
  var port = oasis.ports[capability];

  if (port) {
    Logger.log(oasis.oasisId, "sandbox: found port, setting up '" + capability + "'");
    options.setupCapability(port);

    if (options.promise) {
      options.promise.then(function() {
        port.start();
      })['catch'](RSVP.rethrow);
    } else {
      port.start();
    }
  } else if (!oasis.receivedPorts) {
    Logger.log("No port found, saving handler for '" + capability + "'");
    oasis.handlers[capability] = options;
  } else {
    Logger.log("No port was sent for capability '" + capability + "'");
    options.rejectCapability();
  }
}