Advertisement
Guest User

Untitled

a guest
Sep 1st, 2015
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. globalProducts = new ProductsCollection();
  2.  
  3. function View() {
  4.     this.products = new ProductsCollection(); // local refs to products ( mirror )
  5.     var $this = this;
  6.     $('.product').each( function() {
  7.         var obj = $(this).data('obj');
  8.         var emodel = globalProducts.get(obj.id);
  9.         if( emodel ) {
  10.             emodel.set(obj);
  11.         } else {
  12.             emodel = new ProductModel(obj);
  13.             globalProducts.add(obj);
  14.         }
  15.         this.products.add(emodel);
  16.     });
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement