You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
node-authored/lib/apply-property-map.coffee

12 lines
351 B
CoffeeScript

module.exports = (map, object, domElement) ->
Object.keys(map).forEach (key) ->
if typeof map[key] == "function"
valueFunc = map[key]
object.on "changed:#{key}", (val) ->
[targetName, actualValue] = valueFunc(val)
domElement.css targetName, actualValue
else
object.on "changed:#{key}", (val) ->
domElement.css map[key], val