chore(database): update event listener scope in collection

This commit is contained in:
Chareice 2023-12-14 21:16:10 +08:00
parent 58f1918e73
commit f6fdec1226
No known key found for this signature in database

View File

@ -699,6 +699,17 @@ export class Collection<
};
}
protected bindFieldEventListener() {
this.on('field.afterAdd', (field: Field) => {
field.bind();
});
this.on('field.afterRemove', (field: Field) => {
field.unbind();
this.db.emit('field.afterRemove', field);
});
}
private checkOptions(options: CollectionOptions) {
checkIdentifier(options.name);
this.checkTableName();
@ -716,15 +727,4 @@ export class Collection<
}
}
}
private bindFieldEventListener() {
this.on('field.afterAdd', (field: Field) => {
field.bind();
});
this.on('field.afterRemove', (field: Field) => {
field.unbind();
this.db.emit('field.afterRemove', field);
});
}
}