remy / bind.js

bind.js - simple two way data binding to HTML and callbacks
694 stars 62 forks source link

Interesting bug #29

Closed ismail-codar closed 7 years ago

ismail-codar commented 8 years ago

Pease check: http://jsbin.com/kahecu/edit?js,output

var data = Bind({
  score: 10,
  cats: ['dizzy', 'missy', 'ninja'],
}, {
  score: '.score',
  cats: updateCats
});

setInterval(function () {
  data.score++;
    //data.cats[1] = Math.random(); // !!! IF THIS LINE UNCOMMENTED IT'S CORRECTLY WORKING !!!
    data.cats[3] = Math.random();
  if (data.score > 100) {
    data.score = 0;
  }
}, 500);

function updateCats(list, old) {
  document.querySelector('#cats').innerHTML = '<li>' + list.join('<li>');
}

data.cats.push('sil')
anovsiradj commented 7 years ago

mind blowing!