Conversation
// exporting list of menu constants | ||
Object.keys(MENUS).forEach(function(key) { | ||
exports[key] = MENUS[key]; | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just keep those constants here, I don't think we need that extra module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm using the MENUS
constants in sdk/ui/menuitem.js
and sdk/ui/menuitem/view.js
|
||
let { events: bus } = internals.view = create(model); | ||
let self = this; | ||
on(bus, 'click', function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just use arrow functions, they were invented exactly to fix self
pattern.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just pointed out thing about arrow functions, although I want events to be handled by separate controller.
I think it would be easier to explain what I want here than inline:
|
This makes views and models unaware of each other, or events. You could also go and hook updates into observer notifications to allow ultimate extensibility as we talked before. |
Now that I think more about it, in fact I would also make view creation and view disposal also controllers concern. I would just send update notifications like |
No description provided.