本文整理匯總了TypeScript中@aurelia/runtime.ICollectionObserver類的典型用法代碼示例。如果您正苦於以下問題:TypeScript ICollectionObserver類的具體用法?TypeScript ICollectionObserver怎麽用?TypeScript ICollectionObserver使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了ICollectionObserver類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: setValueCore
public setValueCore(newValue: unknown, flags: LifecycleFlags): void {
const isArray = Array.isArray(newValue);
if (!isArray && newValue !== null && newValue !== undefined && this.obj.multiple) {
throw new Error('Only null or Array instances can be bound to a multi-select.');
}
if (this.arrayObserver) {
this.arrayObserver.unsubscribeBatched(this);
this.arrayObserver = null;
}
if (isArray) {
this.arrayObserver = this.observerLocator.getArrayObserver(this.persistentFlags | flags, newValue as unknown[]);
this.arrayObserver.subscribeBatched(this);
}
this.synchronizeOptions();
this.notify(flags);
}
示例2: setValueCore
public setValueCore(newValue: unknown, flags: LifecycleFlags): void {
if (!this.valueObserver) {
this.valueObserver = this.obj['$observers'] && (this.obj['$observers'].model || this.obj['$observers'].value);
if (this.valueObserver) {
this.valueObserver.subscribe(this);
}
}
if (this.arrayObserver) {
this.arrayObserver.unsubscribeBatched(this);
this.arrayObserver = null;
}
if (this.obj.type === 'checkbox' && Array.isArray(newValue)) {
this.arrayObserver = this.observerLocator.getArrayObserver(this.persistentFlags | flags, newValue);
this.arrayObserver.subscribeBatched(this);
}
this.synchronizeElement();
}
示例3: unbind
public unbind(): void {
this.nodeObserver.disconnect();
this.nodeObserver = null;
if (this.arrayObserver) {
this.arrayObserver.unsubscribeBatched(this);
this.arrayObserver = null;
}
}
示例4: unbind
public unbind(): void {
if (this.arrayObserver) {
this.arrayObserver.unsubscribeBatched(this);
this.arrayObserver = null;
}
if (this.valueObserver) {
this.valueObserver.unsubscribe(this);
}
}