Skip to content

Instantly share code, notes, and snippets.

@alibenpeng
Last active January 4, 2016 16:19
Show Gist options
  • Save alibenpeng/8646556 to your computer and use it in GitHub Desktop.
Save alibenpeng/8646556 to your computer and use it in GitHub Desktop.
module.exports =
rules: [
{
function: (obj) ->
if obj.type == 'rf12button' && obj.mcu_id == 1 && obj.button_id == 2
console.info "YOOOOOOOOOOOOOOOOOOOOOOOOOOOO RIGHT BUTTON!!!!!!!!!!!!!!1111"
->
console.info "OIOIOIOIOIOI RETURN!"
@sendRF12 "5,1,2,0,8s"
condition: "foo"
action: "sendRF12 1,1,2,0,8s"
}
Aufruf:
for k,v in rules.rules
#console.info "RULE CONDITION:", k.condition
#console.info "RULE ACTION:", k.action
action = ->
try action = k.function obj
catch err
#console.info "FUUUUUUUUUUUUUUUUUUUUUUUUUUUUUCK!!!!!!1 FUNCTION ERROR:", err
#console.info "ACTION:", action
try action()
catch err
console.info "FUUUUUUUUUUUUUUUUUUUUUUUUUUUUUCK!!!!!!1 ACTION ERROR:", err
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment