Closed joshuagruenstein closed 8 years ago
Not quite sure how I plan to integrate this into snooze. One possibility is just to provide jquery-style DOM selection and event listening on said selected DOM, but that doesn't seem very snoozesque. I'm considering the angular ng-click system, where bindings are specified in templating.
Ok so I've been giving this a tad more thought, and here's where I'm currently at. You have custom event related tags for HTML elements, lets say snzClk
for example. Snooze maintains an object full of different functions that can be triggered by these events. By setting snzClk
to equal clickFunction
on a button, you've told snooze to run the method under clickFunction
whenever the button is pressed. While this isn't much different than regular events, it doesn't pollute the global namespace, which is nice. It also allows for me to write more event listeners than the standard supported inline ones, and to have more flexibility. This still doesn't sound ideal, but I think it's hard to get something super elegant when you're trying not to be draconian. Snooze isn't the kind of framework to force you to do it the snooze way, and maybe some sacrifices have to be made for that.
Done with the stuff under the checkboxes, so I'm marking this closed. Snooze still doesn't cover all possible listeners, but those can be added later in another issue. Also, if you have some weird esoteric listener you need in your webapp, you can always add it yourself; it's one line of JSON, after all. There's an argument to be made for not "polluting" snooze with lots of features that the majority of users will never need (ahem jQuery).
We should also have a variety of available listeners to start.