Skip to content

Commit

Permalink
Updated reference to datastore + attribute can be changed
Browse files Browse the repository at this point in the history
  • Loading branch information
frostney committed Nov 7, 2013
1 parent f4f09bf commit 43d23de
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/clingy.coffee
@@ -1,11 +1,12 @@
do (root = @) ->
do (root = @, DataStore = @DataStore) ->

jQueryAvail = do -> if root.jQuery then true else false

class Clingy
constructor: (@attribute = 'bind', data = {}) ->
@data = new DataStore data

@data.on 'change', (key, value) ->
elems = document.querySelectorAll "data-bind=#{key}"
@data.on 'change', (key, value) =>
elems = document.querySelectorAll "data-#{@attribute}=#{key}"
e.innerHTML = value for e in elems
null

0 comments on commit 43d23de

Please sign in to comment.