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

To help you get started, we’ve selected a few es6-promise 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 FlashAirDevelopers / FlashAirFileManager / src / renderer / action / iothub-action.js View on Github external
* specific language governing permissions and limitations
 * under the License.
 */

import {remote} from 'electron';
import {inspect} from 'util';
import log from 'electron-log';
import promise from 'es6-promise';
import fetch from 'isomorphic-fetch';

import {IoTHubApi, FlashAIrScript} from '../../common/config';
import {IoTHubApiConst} from '../../common/const';
import {AppEvent} from '../../common/event';
import {basename} from '../../common/util';

promise.polyfill();
const {dialog} = remote;
import fs from 'fs';
import path from 'path';

export class IoTHubAction {
  constructor(dispatcher) {
    this.dispatcher = dispatcher;
  }
  handleHttpStatus(response) {
    if ((response.status === 200)     // Status OK
      || (response.status === 201)    // Created
      || (response.status === 204)) { // No Conten
      return Promise.resolve(response);
    }
    console.log(inspect(response, {
      showHidden: false,
github ArkEcosystem / explorer / src / main.ts View on Github external
// tslint:disable-next-line:no-var-requires
require("es6-promise").polyfill();

import "@/assets/css/style.css";
import "nprogress/nprogress.css";

import Vue from "vue";
import { sync } from "vuex-router-sync";
// @ts-ignore
import App from "./App.vue";
import router from "./router";
import store from "./store";
import directives from "./directives";
import mixins from "./mixins";
// @ts-ignore
import VTooltip from "v-tooltip";
// @ts-ignore
import VueGoodTablePlugin from "vue-good-table";
github ncent / ncent.github.io / SDK / source / index.js View on Github external
require('es6-promise').polyfill();

// // stellar-sdk classes to expose
// export * from "./errors";
// export {Config} from "./config";
// export {Server} from "./server";
// export {FederationServer, FEDERATION_RESPONSE_MAX_SIZE} from "./federation_server";
// export {StellarTomlResolver, STELLAR_TOML_MAX_SIZE} from "./stellar_toml_resolver";

// expose classes and functions from ncentSDK
const ncentSDK = require("./ncentSDK.js");
module.exports = ncentSDK;

//export default module.exports;
github ikhsanalatsary / next-react-boilerplate / sagas / appSaga.js View on Github external
/* global fetch */

import { delay } from 'redux-saga';
import { all, call, put, take, takeLatest } from 'redux-saga/effects';
import es6promise from 'es6-promise';
import 'isomorphic-fetch';

import { LOAD_DATA, START_CLOCK } from '../constants/appConstant';
import { failure, loadDataSuccess, tickClock } from '../actions/appAction';

es6promise.polyfill();

function* runClockSaga() {
  yield take(START_CLOCK);
  /* eslint-disable no-constant-condition */
  while (true) {
    yield put(tickClock(false));
    yield call(delay, 800);
  }
}

function* loadDataSaga() {
  try {
    const res = yield fetch('https://jsonplaceholder.typicode.com/users');
    const data = yield res.json();
    yield put(loadDataSuccess(data));
  } catch (err) {
github Narkoleptika / webpack-everything / template / src / client-entry.js View on Github external
require('stylus/')
require('es6-promise').polyfill()
import Vue from 'vue'
import {app, store, router} from './app'

const isProd = process.env.NODE_ENV === 'production'
// Get matched components by route and load them
const path = getLocation(router.options.base)
const resolveComponents = flatMapComponents(router.match(path), (Component, _, match, key)=> {
    if (typeof Component === 'function' && !Component.options) {
        return new Promise(function(resolve, reject) {
            const _resolve = (Component)=> {
                match.components[key] = Component
                resolve(Component)
            }
            var res = Component(_resolve, reject)
            if (res && res.then) {
                res.then(_resolve).catch(reject)
github bonustrack / steemconnect / src / index.js View on Github external
import React from 'react';
import { Router, useRouterHistory } from 'react-router';
import { Provider } from 'react-redux';
import { createHistory } from 'history';
import ReactDOM from 'react-dom';
import steem from 'steem';
import routes from './routes';
import store from './store';

require('es6-promise').polyfill();
require('isomorphic-fetch');

// load the stylesheet
require('./styles/base.sass');

if (process.env.STEEMJS_URL) {
  steem.api.setOptions({ url: process.env.STEEMJS_URL });
}

const appHistory = useRouterHistory(createHistory)({ queryKey: false });
ReactDOM.render(
  
    
  ,
  document.getElementById('app')
);
github mozilla / id.webmaker.org / templates / pages / migrate.jsx View on Github external
var React = require('react');

var Header = require('../components/header/header.jsx');
var LoginNoPasswordForm = require('../components/login-no-pass-form.jsx');
var KeyEmailed = require('../components/key-emailed.jsx');
var SetPasswordMigrationForm = require('../components/set-password-migration-form.jsx');
var IconText = require('../components/icontext.jsx');
var ga = require('react-ga');
var State = require("react-router").State;
var url = require('url');
var WebmakerActions = require('../lib/webmaker-actions.jsx');
var cookiejs = require('cookie-js');

require('es6-promise').polyfill();
require('isomorphic-fetch');

var UserMigration = React.createClass({
  mixins: [
    State
  ],
  componentDidMount: function() {
    document.title = "Webmaker Login - Set a Password";
  },
  getInitialState: function() {
    return {
      login: false,
      emailedKey: false,
      setPass: !!this.getQuery().token,
      success: false,
      errorMessage: null
github AkyunaAkish / react-redux-node-express-todo-list-boilerplate / client / actions / todos / createTodo.js View on Github external
import p from 'es6-promise';
p.polyfill();
import axios from 'axios';
import {CREATE_TODO} from '../types';

export default function (values, callback) {
    const request = axios.post(`/api/todos`, values)
                            .then(() => {
                                callback();  
                            });

    return {type: CREATE_TODO, payload: request};
};
github happylinks / blrplt / server / server.jsx View on Github external
import 'babel-polyfill';
import path from 'path';

import React from 'react';
import express from 'express';
import bodyParser from 'body-parser';
import cors from 'cors';
import { renderToString, renderToStaticMarkup } from 'react-dom/server';
import { createServerRenderContext } from 'react-router';

require('es6-promise').polyfill();
require('isomorphic-fetch');

import configureStore from '../client/store';
import { Html } from '../client/components';
import App from '../client/app';
import rootSaga from '../client/sagas';

const serverless = process.env.SERVERLESS;

let awsServerlessExpressMiddleware;
if (serverless) {
  awsServerlessExpressMiddleware = require('aws-serverless-express/middleware');
}

const manifest = require('../build/manifest.json');
github keyteki / keyteki / webpack.config.production.js View on Github external
require('es6-promise').polyfill();
var webpack = require('webpack');
var path = require('path');

var BUILD_DIR = path.resolve(__dirname, 'public');
var APP_DIR = path.resolve(__dirname, 'client');
var LESS_DIR = path.resolve(__dirname, 'less');

var config = {
    devtool: 'source-map',
    entry: [
        'babel-polyfill',
        path.join(__dirname, 'client/index.jsx'),
        LESS_DIR + '/site.less'
    ],
    output: {
        path: BUILD_DIR,