How to use the rsvp.on 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 0dp / generator-wp-bones / libs / clone-bones.js View on Github external
'use strict';

// dependancies
var fs = require('fs');
var RSVP = require('rsvp');
var simpleGit = require('simple-git')();
var exec = require('child_process').exec;
var rmdir = require('rmdir');

// Bones git repo url
var bones = 'git://github.com/eddiemachado/bones.git';

// Configure RSVP promise to yell when something goes wrong
// --------------------------------------------------------
RSVP.on('error', function(e) {
  console.log(e.message);
  console.log(e.stack);
});

// Helper function to create a directory with a path given
// -------------------------------------------------------
var createDir = function (localPath, resolve, reject) {
  fs.mkdir(localPath, function (err) {
    if (err) {
      // if something goes wrong, tell the parent
      return reject(err);
    }
    // directory created, we can go on
    return resolve();
  });
};
github parkjs814 / DuoCoder / js / index.js View on Github external
const RSVP = require('rsvp');
const DOM = require('./dom');
const Server = require('./server');
const Storage = require('./storage');
const app = require('./app');
const App = require('./app/constructor');
const {Language} = require('./bean');
const {extend} = $;

const categories = Server.getCategories();
const from = 0, to = 1;

// set global promise error handler
RSVP.on('error', function (reason) {
  console.assert(false, reason);
});

extend(true, window, {
  main: DOM.setupMain,
  learn: () => {
    extend(true, app, new App());
    extend(true, window, {app});
    let lang_from_ext = getUrlParameter('lang_from');
    let lang_to_ext = getUrlParameter('lang_to');
    if (lang_from_ext && lang_to_ext) {
      const changed_from = Storage.language.set(from, lang_from_ext);
      const changed_to = Storage.language.set(to, lang_to_ext);
      if (changed_from || changed_to) Storage.category.set(categories[0].sub(0));
    } else {
      lang_from_ext = Storage.language.get(from);
github filamentgroup / directory-colorfy / lib / colorfy.js View on Github external
(function(){
	"use strict";

	var RSVP = require( 'rsvp' );
	var fs = require( 'fs-extra' );
	var path = require( 'path' );

	var workerFarm = require( '@filamentgroup/worker-farm' );
	var workers = workerFarm(require.resolve( path.join( __dirname, "convert" ) ) );

	RSVP.on( 'error', function(err){
		process.stderr.write( err.stack );
	});

	var colorsRegx = /\.colors\-([^\.]+)/i;

	var isColorWord = function( val ){
		var acceptable = ["black","silver","gray","white","maroon","red","purple","fuchsia","green","lime","olive","yellow","navy","blue","teal","aqua","aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"];
		return acceptable.indexOf( val ) > -1;
	};
	// test if value is a valid hex
	var isHex = function( val ){
		return (/^[0-9a-f]{3}(?:[0-9a-f]{3})?$/i).test( val );
	};


	var Colorfy = function( filepath, extraColors, opts ){
github algorithm-visualizer / algorithm-visualizer / js / index.js View on Github external
cache: false,
  dataType: 'text'
});

const {
  isScratchPaper
} = require('./utils');

const {
  getHashValue,
  getParameterByName,
  getPath
} = require('./server/helpers');

// set global promise error handler
RSVP.on('error', function (reason) {
  console.assert(false, reason);
});

$(() => {

  // initialize the application and attach in to the instance module
  const appConstructor = new AppConstructor();
  extend(true, app, appConstructor);

  // load modules to the global scope so they can be evaled
  extend(true, window, modules);

  Server.loadCategories().then((data) => {
    app.setCategories(data);
    DOM.addCategories();
github linkedin / postcss-lang-optimizer / test / test_langOptimizer.js View on Github external
* Unless required by applicable law or agreed to in writing, software distributed under
 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied.
 */

"use strict";

var assert = require("assert");
var path = require("path");
var fs = require("fs");
var broccoli = require("broccoli");
var RSVP = require("rsvp");
var glob = require("glob");

RSVP.on("error", function(reason, label) {
  if (label) {
    console.error(label);
  }

  console.assert(false, reason.message);
});


var LangOptimizer = require("../lib/langOptimizer");

function fixtureSourceDir(name) {
  return path.resolve(__dirname, "fixtures", name, "input");
}

function fixtureOutputDir(name) {
  return path.resolve(__dirname, "fixtures", name, "output");
}
github ef4 / fast-sourcemap-concat / test / go.js View on Github external
var SourceMap = require('..');
var RSVP = require('rsvp');
var mkdirp = require('mkdirp');
RSVP.on('error', function(err){throw err;});

mkdirp('tmp');


function once() {

  var s = new SourceMap({outputFile: 'tmp/intermediate.js'});

  s.addFile('fixtures/inner/first.js');
  var filler = "'x';";
  s.addSpace(filler);

  s.addFile('fixtures/inner/second.js');

  return s.end().then(function(){
    s = new SourceMap({outputFile: 'tmp/intermediate2.js'});
github reactcli / react-cli / lib / cli / cli.js View on Github external
run(environment) {
    rsvp.on('error', (e) => {
      console.log(chalk.red(e.stack));
    });

    rsvp.hash(environment || {}).then(environment => {
      let args = environment.args,
        commandName = args.shift(),
        commandArgs = args,
        Command = lookupCommand(environment.commands, commandName, commandArgs),
        command = new Command({
          commands: environment.commands,
          name: commandName,
          project: environment.project
        });

      if (environment.project) {
        process.chdir(environment.project.root);
github mirego / ember-boilerplate / app / services / raven.js View on Github external
if (this.get('isRavenUsable') && !this.get('globalErrorCatchingInitialized')) {
      const _oldOnError = Ember.onerror;

      Ember.onerror = (error) => {
        if (this._ignoreError(error)) {
          return;
        }

        this.captureException(error);
        this.didCaptureException(error);
        if (typeof(_oldOnError) === 'function') {
          _oldOnError.call(Ember, error);
        }
      };

      RSVP.on('error', (reason, label) => {
        if (this._ignoreError(reason)) {
          return;
        }

        if (typeOf(reason) === 'error') {
          this.captureException(reason, {
            extra: {
              context: label || this.get('unhandledPromiseErrorMessage')
            }
          });
          this.didCaptureException(reason);
        } else {
          this.captureMessage(this._extractMessage(reason), {
            extra: {
              reason,
              context: label
github ember-cli-sentry / ember-cli-sentry / addon / services / raven.js View on Github external
if (this.get('isRavenUsable') && !this.get('globalErrorCatchingInitialized')) {
      const _oldOnError = Ember.onerror;

      Ember.onerror = (error) => {
        if (this._ignoreError(error)) {
          return;
        }

        this.captureException(error);
        this.didCaptureException(error);
        if (typeof(_oldOnError) === 'function') {
          _oldOnError.call(Ember, error);
        }
      };

      RSVP.on('error', (reason, label) => {
        if (this._ignoreError(reason)) {
          return;
        }

        if (typeOf(reason) === 'error') {
          this.captureException(reason, {
            extra: {
              context: label || this.get('unhandledPromiseErrorMessage'),
            },
          });
          this.didCaptureException(reason);
        } else {
          this.captureMessage(this._extractMessage(reason), {
            extra: {
              reason,
              context: label,
github emberjs / ember.js / packages / @ember / -internals / runtime / lib / ext / rsvp.js View on Github external
import * as RSVP from 'rsvp';
import { backburner, _rsvpErrorQueue } from '@ember/runloop';
import { getDispatchOverride } from '@ember/-internals/error-handling';
import { assert } from '@ember/debug';

RSVP.configure('async', (callback, promise) => {
  backburner.schedule('actions', null, callback, promise);
});

RSVP.configure('after', cb => {
  backburner.schedule(_rsvpErrorQueue, null, cb);
});

RSVP.on('error', onerrorDefault);

export function onerrorDefault(reason) {
  let error = errorFor(reason);
  if (error) {
    let overrideDispatch = getDispatchOverride();
    if (overrideDispatch) {
      overrideDispatch(error);
    } else {
      throw error;
    }
  }
}

function errorFor(reason) {
  if (!reason) return;