How to use the @aurelia/runtime.ContinuationTask function in @aurelia/runtime

To help you get started, we’ve selected a few @aurelia/runtime 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 aurelia / aurelia / packages / runtime-html / dist / umd / resources / custom-attributes / portal.js View on Github external
if ((this.$controller.state & 40 /* isAttachedOrAttaching */) === 0) {
                return task;
            }
            if (typeof activating === 'function') {
                if (task.done) {
                    task = toTask(activating.call(callbackContext, target, view));
                }
                else {
                    task = new runtime_1.ContinuationTask(task, activating, callbackContext, target, view);
                }
            }
            if (task.done) {
                view.attach(flags);
            }
            else {
                task = new runtime_1.ContinuationTask(task, view.attach, view, flags);
            }
            if (typeof activated === 'function') {
                if (task.done) {
                    // TODO: chain this up with RAF queue mount callback so activated is called only when
                    // node is actually mounted (is this needed as per the spec of this resource?)
                    task = toTask(activated.call(callbackContext, target, view));
                }
                else {
                    task = new runtime_1.ContinuationTask(task, activated, callbackContext, target, view);
                }
            }
            return task;
        }
        deactivate(flags) {
github aurelia / aurelia / packages / runtime-html / src / resources / custom-attributes / portal.ts View on Github external
}
    }

    if (task.done) {
      view.attach(flags);
    } else {
      task = new ContinuationTask(task, view.attach, view, flags);
    }

    if (typeof activated === 'function') {
      if (task.done) {
        // TODO: chain this up with RAF queue mount callback so activated is called only when
        // node is actually mounted (is this needed as per the spec of this resource?)
        task = toTask(activated.call(callbackContext, target, view));
      } else {
        task = new ContinuationTask(task, activated, callbackContext, target, view);
      }
    }

    return task;
  }
github aurelia / aurelia / packages / runtime-html / dist / umd / resources / custom-elements / compose.js View on Github external
let viewPromise;
                if (task.done) {
                    viewPromise = subject.then(s => this.resolveView(s, flags));
                }
                else {
                    viewPromise = task.wait().then(() => subject.then(s => this.resolveView(s, flags)));
                }
                task = new runtime_1.PromiseTask(viewPromise, this.activate, this, flags);
            }
            else {
                const view = this.resolveView(subject, flags);
                if (task.done) {
                    task = this.activate(view, flags);
                }
                else {
                    task = new runtime_1.ContinuationTask(task, this.activate, this, view, flags);
                }
            }
            if (task.done) {
                this.onComposed();
            }
            else {
                task = new runtime_1.ContinuationTask(task, this.onComposed, this);
            }
            return task;
        }
        deactivate(flags) {
github aurelia / aurelia / packages / runtime-html / src / resources / custom-elements / compose.ts View on Github external
let task = this.deactivate(flags);

    if (subject instanceof Promise) {
      let viewPromise: Promise | undefined>;
      if (task.done) {
        viewPromise = subject.then(s => this.resolveView(s, flags));
      } else {
        viewPromise = task.wait().then(() => subject.then(s => this.resolveView(s, flags)));
      }
      task = new PromiseTask<[LifecycleFlags], IController | undefined>(viewPromise, this.activate, this, flags);
    } else {
      const view = this.resolveView(subject, flags);
      if (task.done) {
        task = this.activate(view, flags);
      } else {
        task = new ContinuationTask(task, this.activate, this, view, flags);
      }
    }

    if (task.done) {
      this.onComposed();
    } else {
      task = new ContinuationTask(task, this.onComposed, this);
    }

    return task;
  }
github aurelia / aurelia / packages / runtime-html / src / resources / custom-attributes / portal.ts View on Github external
} else {
        task = new ContinuationTask(task, deactivating, callbackContext, target, view);
      }
    }

    if (task.done) {
      view.detach(flags);
    } else {
      task = new ContinuationTask(task, view.detach, view, flags);
    }

    if (typeof deactivated === 'function') {
      if (task.done) {
        task = toTask(deactivated.call(callbackContext, target, view));
      } else {
        task = new ContinuationTask(task, deactivated, callbackContext, target, view);
      }
    }

    return task;
  }
github aurelia / aurelia / packages / runtime-html / dist / esnext / resources / custom-attributes / portal.js View on Github external
deactivate(flags) {
        const { deactivating, deactivated, callbackContext, view, target: target } = this;
        let task = this.task;
        if (typeof deactivating === 'function') {
            if (task.done) {
                task = toTask(deactivating.call(callbackContext, target, view));
            }
            else {
                task = new ContinuationTask(task, deactivating, callbackContext, target, view);
            }
        }
        if (task.done) {
            view.detach(flags);
        }
        else {
            task = new ContinuationTask(task, view.detach, view, flags);
        }
        if (typeof deactivated === 'function') {
            if (task.done) {
                task = toTask(deactivated.call(callbackContext, target, view));
            }
            else {
                task = new ContinuationTask(task, deactivated, callbackContext, target, view);
            }
        }
github aurelia / aurelia / packages / runtime-html / dist / umd / resources / custom-elements / compose.js View on Github external
beforeBind(flags) {
            if (this.task.done) {
                this.task = this.compose(this.subject, flags);
            }
            else {
                this.task = new runtime_1.ContinuationTask(this.task, this.compose, this, this.subject, flags);
            }
            if (this.task.done) {
                this.task = this.bindView(flags);
            }
            else {
                this.task = new runtime_1.ContinuationTask(this.task, this.bindView, this, flags);
            }
            return this.task;
        }
        beforeAttach(flags) {
github aurelia / aurelia / packages / runtime-html / dist / esnext / resources / custom-elements / compose.js View on Github external
beforeBind(flags) {
        if (this.task.done) {
            this.task = this.compose(this.subject, flags);
        }
        else {
            this.task = new ContinuationTask(this.task, this.compose, this, this.subject, flags);
        }
        if (this.task.done) {
            this.task = this.bindView(flags);
        }
        else {
            this.task = new ContinuationTask(this.task, this.bindView, this, flags);
        }
        return this.task;
    }
    beforeAttach(flags) {