Advertisement
Guest User

Untitled

a guest
Sep 8th, 2015
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function Product(toConvert) {
  2.     this.description = '';
  3.     this.name = '';
  4.     this.attribute = [];
  5.     this.children = [];
  6.     this.parents = [];
  7.         this.rules = makeRules();
  8.            
  9.     angular.extend(this, toConvert);
  10. }
  11.        
  12. angular.extend(Product, {
  13.            
  14. });
  15.  
  16. function makeRules(){
  17.     return {
  18.         onChange: function() {
  19.             console.log("Applying global change rules: ", this);
  20.         },
  21.         onInstantiation: function() {
  22.             console.log("Applying instantiation rules: ", this);
  23.         },
  24.         onContextApplication: function(room) {
  25.             this.context = room;
  26.             console.log("Applying context rules: ", this, room);
  27.         },
  28.     }
  29. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement