How to use the native-promise-only.all 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 intervalia / gulp-component-assembler / src / watcher.js View on Github external
watchedFiles[file].forEach(function(assembly) {
      promises.push(new Promise(function(resolve, reject) {
        touch(assembly, function() {
          resolve();
        });
      }));
    });

    // Remove references to the file but don't unwatch it
    delete watchedFiles[file];
  }

  // Add events always fire a change event for the same file, so we'll ignore add events
  if (event !== 'add') {
    // The file is done touching any parent files
    Promise.all(promises).then(function() {
      touchedFiles++;

      // fire the event once all filesToTouch and have been touched
      if (filesToTouch > 0 && touchedFiles === filesToTouch) {

        filesToTouch = 1;  // always count the staring file
        touchedFiles = 0;
        touchEvents.emit('allTouched');
      }
    });
  }
}
github formio / angular-formio / src / modules / resource / resource.service.ts View on Github external
property: 'submission',
                            value: this.resource
                        });

                        return {
                            name: parent,
                            resource: resource
                        };
                    }
                    return null;
                }));
            }
        });

        // When all the parents have loaded, emit that to the onParents emitter.
        Promise.all(parentsLoaded).then((parents: any) => this.onParents.emit(parents));
    }
github formio / formio.js / src / components / _classes / nested / NestedComponent.js View on Github external
beforeSubmit() {
    return NativePromise.all(this.getComponents().map((comp) => comp.beforeSubmit()));
  }
github formio / formio.js / src / components / file / File.js View on Github external
setValue(value) {
    const newValue = value || [];
    const changed = this.hasChanged(newValue, this.dataValue);
    this.dataValue = newValue;
    if (this.component.image) {
      this.loadingImages = [];
      const images = Array.isArray(newValue) ? newValue : [newValue];
      images.map((fileInfo) => {
        if (fileInfo && Object.keys(fileInfo).length) {
          this.loadingImages.push(this.loadImage(fileInfo));
        }
      });
      if (this.loadingImages.length) {
        NativePromise.all(this.loadingImages)
          .then(() => {
            this.refreshDOM();
            setTimeout(() => this.filesReadyResolve(), 100);
          })
          .catch(() => this.filesReadyReject());
      }
    }
    else {
      this.refreshDOM();
      this.filesReadyResolve();
    }
    return changed;
  }
github imsky / pull-review / src / response.js View on Github external
function successfulReviewFlow (review, resources) {
    var inputs;

    return Promise.all([review, resources])
      .then(function (res) {
        var review = res[0] || {};
        var resources = res[1];

        inputs = {
          'reviewers': review.reviewers,
          'resources': resources
        };

        var assignees = (review.reviewers || []).map(function (reviewer) {
          return reviewer.login;
        });

        function liveRun() {
          return github.assignUsersToResource(resources[0], assignees)
            .then(function () {
github formio / formio.js / src / components / _classes / nested / NestedComponent.js View on Github external
collapsed: this.collapsed,
      [this.nestedKey]: 'single',
    });

    let childPromise = NativePromise.resolve();
    if (this.refs[this.nestedKey]) {
      childPromise = this.attachComponents(this.refs[this.nestedKey]);
    }

    if (this.component.collapsible && this.refs.header) {
      this.addEventListener(this.refs.header, 'click', () => {
        this.collapsed = !this.collapsed;
      });
    }

    return NativePromise.all([
      superPromise,
      childPromise,
    ]);
  }
github formio / formio.js / src / components / _classes / nested / NestedComponent.js View on Github external
get dataReady() {
    return NativePromise.all(this.getComponents().map((component) => component.dataReady));
  }
github formio / formio.js / src / components / _classes / nested / NestedComponent.js View on Github external
get ready() {
    return NativePromise.all(this.getComponents().map(component => component.ready));
  }
github formio / formio.js / src / components / _classes / nested / NestedComponent.js View on Github external
container = container || this.component.components;

    element = this.hook('attachComponents', element, components, container, this);
    if (!element) {
      return;
    }

    let index = 0;
    const promises = [];
    Array.prototype.slice.call(element.children).forEach(child => {
      if (!child.getAttribute('data-noattach') && components[index]) {
        promises.push(components[index].attach(child));
        index++;
      }
    });
    return NativePromise.all(promises);
  }
github imsky / pull-review / src / github / index.js View on Github external
function getGithubResources (githubURLs) {
  var githubResources = githubURLs.map(function (uo) {
    return parseGithubPath(uo.path);
  });

  return Promise.all(githubResources.map(fetchGithubResourceData));
}

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