Frontmatter
| id | 2789 |
| title | core.Observable:fire() => add a check for string based event handlers |
| state | Closed |
| labels | enhancement |
| assignees | tobiu |
| createdAt | Jan 2, 2022, 3:44 PM |
| updatedAt | Jan 2, 2022, 3:56 PM |
| githubUrl | https://github.com/neomjs/neo/issues/2789 |
| author | tobiu |
| commentsCount | 0 |
| parentIssue | null |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Jan 2, 2022, 3:56 PM |
by default, view controllers will map those into their scope, if available.
however, in case we want to override event handlers (e.g. when defining a plugin), it can be handy to go for string based events which will get scoped to their fn once the first event fires.
example (list.Base):
afterSetStore(value, oldValue) { let me = this; value?.on({ filter : me.onStoreFilter, load : me.onStoreLoad, recordChange: me.onStoreRecordChange, scope : me }); value?.getCount() > 0 && me.onStoreLoad(); }could become:
afterSetStore(value, oldValue) { let me = this; value?.on({ filter : 'onStoreFilter', load : 'onStoreLoad', recordChange: 'onStoreRecordChange', scope : me }); value?.getCount() > 0 && me.onStoreLoad(); }in which case
list.plugin.Animatecan override the store event-handlers.