Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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) {
}
}
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;
}
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) {
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;
}
} 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;
}
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);
}
}
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) {
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) {