ai / evil-blocks

Tiny framework for web pages to split your app to separated blocks
MIT License
131 stars 10 forks source link

Self triggering events #30

Open chrome opened 10 years ago

chrome commented 10 years ago

I have a proposal to extend events binding syntax with following:

'change on @countrySelect!': ->

Event with ! on the end of declaration, should be triggered right after binding. This should be helpful for events like:

'resize on window!':->
  @block.width $(window).width() / 2

or

'change on @countrySelect!': ->
  @populateCitySelect(@countries[@countrySelect.val()].cities)

for quick setup initial values.

ai commented 10 years ago

Yeap, we need it ut maybe we should use more understandable syntax?

'init resize on window':->

or

'now resize on window':->
ai commented 10 years ago

But here we block to use init event. So maybe:

'resize on window and init':->