Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function imagick() {
  2.   this.composit = function(param1) { return new _composit(param1, this) }
  3.   this.convert = function(param2) { return new _convert(param2, this) }
  4. }
  5.  
  6. function _composit(param, parent) {
  7.   // reference to parent object
  8.   this.parentObj = parent;
  9.  
  10.   this.att = param
  11.  
  12.   console.log(this.att);
  13.  
  14.   this.test = function (obj) {
  15.     console.log(obj);
  16.  
  17.     // return to reference from itself
  18.     return this;
  19.   }
  20.  
  21.   this.end = function() {
  22.     // return to reference of parent object
  23.     return this.parentObj;
  24.   }
  25. }
  26.  
  27. function _convert(param, parent) {
  28.   // reference to parent object
  29.   this.parentObj = parent;
  30.  
  31.   // saving param
  32.   this.att = param;
  33.  
  34.   // printing att
  35.   console.log(this.att);
  36.  
  37.   this.resize = function (obj) {
  38.     console.log(obj);
  39.  
  40.     // return to reference from itself
  41.     return this;
  42.   }
  43.  
  44.   this.end = function() {
  45.     // return to reference of parent object
  46.     return this.parentObj;
  47.   }
  48. }
  49.  
  50.  
  51. var im = new imagick();
  52.  
  53. im.composit("test1").test("test2").end().composit("test3").test("test4");
  54. im.convert("blah").resize("blub").end();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement