How to use the native-promise-only.reject function in native-promise-only

To help you get started, we’ve selected a few native-promise-only 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 formio / formio.js / src / Formio.js View on Github external
loadFormRevision(vid, query, opts) {
    if (!this.formUrl && !this.vUrl) {
      return NativePromise.reject('No form url set.');
    }

    // Set the version url if not set.
    if (vid && !this.vUrl) {
      this.vId = vid;
      this.vUrl = `${this.formUrl}/v/${vid}`;
    }

    // If they specified a revision form, load the revised form components.
    if (query && isObject(query)) {
      query = Formio.serialize(query.params);
    }
    if (query) {
      query = this.query ? (`${this.query}&${query}`) : (`?${query}`);
    }
    else {
github formio / formio.js / src / Formio.js View on Github external
static ssoInit(type, options) {
    switch (type) {
      case 'saml':
        return Formio.samlInit(options);
      case 'okta':
        return Formio.oktaInit(options);
      default:
        console.warn('Unknown SSO type');
        return NativePromise.reject('Unknown SSO type');
    }
  }
github formio / formio.js / src / Formio.js View on Github external
.catch((err) => {
        if (err === 'Bad Token') {
          Formio.setToken(null, opts);
          Formio.events.emit('formio.badToken', err);
        }
        if (err.message) {
          err.message = `Could not connect to API server (${err.message})`;
          err.networkError = true;
        }

        if (method === 'GET') {
          delete Formio.cache[cacheKey];
        }

        return NativePromise.reject(err);
      });
github formio / formio.js / src / Formio.js View on Github external
.then((error) => {
              return NativePromise.reject(error);
            });
        }
github formio / formio.js / src / Webform.js View on Github external
      .catch((err) => Promise.reject(this.onSubmissionError(err)));
  }
github formio / formio.js / src / components / base / Base.js View on Github external
.then(() => {
        if (!element.parentNode) {
          return NativePromise.reject();
        }
        this.quill = new Quill(element, settings);

        /** This block of code adds the [source] capabilities.  See https://codepen.io/anon/pen/ZyEjrQ **/
        const txtArea = document.createElement('textarea');
        txtArea.setAttribute('class', 'quill-source-code');
        this.quill.addContainer('ql-custom').appendChild(txtArea);
        const qlSource = element.parentNode.querySelector('.ql-source');
        if (qlSource) {
          this.addEventListener(qlSource, 'click', (event) => {
            event.preventDefault();
            if (txtArea.style.display === 'inherit') {
              this.quill.setContents(this.quill.clipboard.convert(txtArea.value));
            }
            txtArea.style.display = (txtArea.style.display === 'none') ? 'inherit' : 'none';
          });
github formio / formio.js / src / components / _classes / component / Component.js View on Github external
Component.libraryReady = function(name) {
  if (
    Component.externalLibraries.hasOwnProperty(name) &&
    Component.externalLibraries[name].ready
  ) {
    return Component.externalLibraries[name].ready;
  }

  return NativePromise.reject(`${name} library was not required.`);
};
github formio / formio.js / src / Formio.js View on Github external
static libraryReady(name) {
    if (
      Formio.libraries.hasOwnProperty(name) &&
      Formio.libraries[name].ready
    ) {
      return Formio.libraries[name].ready;
    }

    return NativePromise.reject(`${name} library was not required.`);
  }
}
github formio / formio.js / src / Formio.js View on Github external
load(type, query, opts) {
    const _id = `${type}Id`;
    const _url = `${type}Url`;
    if (query && isObject(query)) {
      query = Formio.serialize(query.params);
    }
    if (query) {
      query = this.query ? (`${this.query}&${query}`) : (`?${query}`);
    }
    else {
      query = this.query;
    }
    if (!this[_id]) {
      return NativePromise.reject(`Missing ${_id}`);
    }
    return this.makeRequest(type, this[_url] + query, 'get', null, opts);
  }

native-promise-only

Native Promise Only: A polyfill for native ES6 Promises **only**, nothing else.

MIT
Latest version published 9 years ago

Package Health Score

55 / 100
Full package analysis