How to use the promise-polyfill._unhandledRejectionFn function in promise-polyfill

To help you get started, we’ve selected a few promise-polyfill 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 samdenty / injectify / src / inject / core / core / lib / Promise.ts View on Github external
import { Injectify } from '../../definitions/core'
declare const injectify: typeof Injectify
import * as PromisePolyfill from 'promise-polyfill'
import * as Guid from 'guid'

PromisePolyfill._unhandledRejectionFn = (e) => {
  if (injectify) {
    injectify.error(e.stack)
  }
}

export default PromisePolyfill

/**
 * Promise-like replacement that allows the handler to check
 * whether it's being observed (eg. has .then() or .catch())
 */
interface Result extends Promise {
  id: string
}
type Vowed = (
  Observed: boolean,
github TriplyDB / YASGUI / src / stories.js View on Github external
var ATTRS = {
  URL_LINK: "data-query",
  SPARQL_REF: "data-query-sparql",
  ENDPOINT: "data-query-endpoint",
  OUTPUT: "data-query-output"
};

var $ = require("jquery");
var linkUtils = require("./shareLink");
var Promise = require("promise-polyfill");
//This lib _requires_ a catch clause (we use just a second arg in the then)
//so disable these warning
Promise._unhandledRejectionFn = function(rejectError) {};
var urlParse = require("url-parse");
module.exports = function(yasguiOptions) {
  $(document).ready(function() {
    window.yasgui = [];
    var yasguiStoryItems = $("[" + ATTRS.URL_LINK + "]");
    var count = 0;
    function loadEls() {
      if (count >= yasguiStoryItems.length) {
        //loaded everything, so we're done
      } else {
        loadEl(yasguiStoryItems[count], 0, count).then(function() {
          count++;
          loadEls();
        });
      }
    }