How to use the intern/dojo/Promise.Deferred function in intern

To help you get started, we’ve selected a few intern 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 medialize / ally.js / test / helper / test-worker.js View on Github external
run: function(modules, callback) {
      var id = this.counter++;
      this.worker.postMessage({
        id: id,
        modules: (typeof modules === 'string' ? [modules] : modules) || [],
        callback: String(callback),
      });
      var dfd = new Promise.Deferred();
      this.deferreds[id] = dfd;
      dfd.promise.test = this._wrapTest.bind(this, dfd.promise);
      return dfd.promise;
    },
  };
github medialize / ally.js / test / helper / delay.js View on Github external
return function delay(duration) {
    var dfd = new Promise.Deferred();
    setTimeout(dfd.resolve, duration);
    return dfd.promise;
  };
});
github medialize / ally.js / test / helper / test-frame.js View on Github external
initialize: function(parent) {
      var dfd = new Promise.Deferred();

      this.element = document.createElement('iframe');
      parent.appendChild(this.element);
      this.window = this.element.contentWindow;
      this.document = this.window.document;

      this.document.open();
      this.document.write(this.source);
      this.document.close();

      if (!this.window) {
        dfd.reject();
        return dfd.promise;
      }

      var resolve = function() {