Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- globalProducts = new ProductsCollection();
- function View() {
- this.products = new ProductsCollection(); // local refs to products ( mirror )
- var $this = this;
- $('.product').each( function() {
- var obj = $(this).data('obj');
- var emodel = globalProducts.get(obj.id);
- if( emodel ) {
- emodel.set(obj);
- } else {
- emodel = new ProductModel(obj);
- globalProducts.add(obj);
- }
- this.products.add(emodel);
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement