Skip to content

Commit

Permalink
Updated croque trigger
Browse files Browse the repository at this point in the history
  • Loading branch information
acadet committed Feb 8, 2014
1 parent 07a6fe9 commit 85c6c67
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 24 deletions.
38 changes: 15 additions & 23 deletions coffee/system/CroqueTrigger.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,19 @@ miam(
Log.w 'An error has occured when trying fixing triggers'
ExceptionHandler.handle error
return null


@bindTriggers: (events) ->
for e in events
$('*[data-on' + Utils.capitalize(e)).each (index, element) =>
method = CroqueTrigger.getMethod e, element
if not method? then return

$(element).on e.toLowerCase(), (event) =>
try
eval 'window.Croque.getMainClass().' + method + '(element, event)'
catch error
Log.w 'An error has occurend when trying applying method'
ExceptionHandler.handle error

###
# Sets mouse listeners
Expand All @@ -50,17 +62,7 @@ miam(
'mouseDown'
]

for e in events
$('*[data-on' + Utils.capitalize(e)).each (index, element) =>
method = CroqueTrigger.getMethod e, element
if not method? then return

$(element).on e.toLowerCase(), () =>
try
eval 'window.Croque.getMainClass().' + method + '(element)'
catch error
Log.w 'An error has occurend when trying applying method'
ExceptionHandler.handle error
CroqueTrigger.bindTriggers events


###
Expand All @@ -73,17 +75,7 @@ miam(
'keyUp'
]

for e in events
$('*[data-on' + Utils.capitalize(e)).each (index, element) =>
method = CroqueTrigger.getMethod e, element
if not method? then return

$(element).on e.toLowerCase(), (event) =>
try
eval 'window.Croque.getMainClass().' + method + '(element, event)'
catch error
Log.w 'An error has occurend when trying applying method'
ExceptionHandler.handle error
CroqueTrigger.bindTriggers events

###
# Sets touch listeners
Expand Down
2 changes: 1 addition & 1 deletion js/system/CroqueTrigger.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 85c6c67

Please sign in to comment.