Skip to content

Instantly share code, notes, and snippets.

@nnarhinen nnarhinen/some.html
Created Nov 26, 2013

Embed
What would you like to do?
Make your plain javascript objects and arrays observable with just jquery, jsfiddle: http://jsfiddle.net/EeGkU/3/
<p>Observable plain javascript objects with jQuery (rendered with transparency.js)</p>
<ul class="items">
<li class="title"></li>
</ul>
<p>Wait for a few seconds and watch the last item in list</p>
var items = [
{title: "First"},
{title: "Second"},
{title: "Third"}
];
$('.items').render(items);
$(items).on('change', function() { $('.items').render(items); });
setTimeout(function() {
var itm = items[2];
itm.title = 'Changed';
$(itm).trigger('change');
}, 5000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.