evil-blocks icon indicating copy to clipboard operation
evil-blocks copied to clipboard

Self triggering events

Open chrome opened this issue 9 years ago • 2 comments

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.

chrome avatar Oct 23 '14 12:10 chrome

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

'init resize on window':->

or

'now resize on window':->

ai avatar Oct 23 '14 13:10 ai

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

'resize on window and init':->

ai avatar Oct 23 '14 13:10 ai