chore(database): update event listener scope in collection
This commit is contained in:
parent
58f1918e73
commit
f6fdec1226
@ -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);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user