How to use the native-promise-only.resolve 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 / Webform.js View on Github external
setForm(form) {
    // Create the form.
    this._form = form;

    // Allow the form to provide component overrides.
    if (form && form.settings && form.settings.components) {
      this.options.components = form.settings.components;
    }

    this.initialized = false;
    const rebuild = this.rebuild() || NativePromise.resolve();
    return rebuild.then(() => {
      this.emit('formLoad', form);
      this.triggerRecaptcha();
      // Make sure to trigger onChange after a render event occurs to speed up form rendering.
      setTimeout(() => {
        this.onChange();
        this.formReadyResolve();
      }, 0);
      return this.formReady;
    });
  }
github formio / formio.js / src / builders / webform / WebformBuilder.js View on Github external
parentComponent.saveChildComponent(submissionData);
      }
      const rebuild = parentComponent.rebuild() || NativePromise.resolve();
      return rebuild.then(() => {
        this.emit('saveComponent',
          parentContainer ? parentContainer[index] : [],
          originalComponent,
          parentComponent.component,
          path,
          index,
          isNew
        );
        this.emit('change', this.form);
      });
    }
    return NativePromise.resolve();
  }
github formio / formio.js / src / components / base / Base.js View on Github external
localize() {
    if (i18next.initialized) {
      return Promise.resolve(i18next);
    }
    i18next.initialized = true;
    return new Promise((resolve, reject) => {
      i18next.init(this.options.i18n, (err, t) => {
        if (err) {
          return reject(err);
        }
        resolve(i18next);
      });
    });
  }
github formio / formio.js / src / formio.full.js View on Github external
Formio.createForm = (element, form, options) => {
  if (typeof form === 'string') {
    return (new Formio(form)).loadForm().then((formObj) => {
      let instance = Formio.formFactory(element, formObj, options);
      instance.url = form;
      instance.nosubmit = false;
      instance.loadSubmission();
      return instance.ready.then(() => instance);
    });
  }
  else {
    return Promise.resolve(Formio.formFactory(element, form, options));
  }
};
github formio / formio.js / src / Formio.js View on Github external
getProjectId() {
    if (!this.projectId) {
      return NativePromise.resolve('');
    }
    if (this.isObjectId(this.projectId)) {
      return NativePromise.resolve(this.projectId);
    }
    else {
      return this.loadProject().then((project) => {
        return project._id;
      });
    }
  }
github formio / formio.js / src / components / tree / Tree.js View on Github external
attachNode(element, node) {
    if (!element) {
      return NativePromise.resolve();
    }

    let componentsPromise = NativePromise.resolve();
    let childrenPromise = NativePromise.resolve();

    node.refs = _.reduce(
      element.children,
      (refs, child) => (
        child.hasAttribute('ref')
          ? {
            ...refs,
            [child.getAttribute('ref')]: child,
          }
          : refs
      ),
      {},
    );

    if (node.refs.content) {
github formio / formio.js / src / components / tree / Tree.js View on Github external
attachComponents(node, ...args) {
    if (this.builderMode) {
      return super.attachComponents.call(this, node, ...args);
    }

    this.loadRefs.call(node, node.refs.content, {
      nodeEdit: 'single',
    });

    return node.refs.nodeEdit
      ? super.attachComponents(node.refs.nodeEdit, node.components)
      : NativePromise.resolve();
  }
github vimeo / player.js / src / player.js View on Github external
ready() {
        const readyPromise = readyMap.get(this) || new Promise((resolve, reject) => {
            reject(new Error('Unknown player. Probably unloaded.'));
        });
        return Promise.resolve(readyPromise);
    }

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