{"version":3,"sources":["https://lively-kernel.org/lively4/swd21-pipes-and-filters/demos/swd21/pipes-and-filters/filter2.js"],"names":["Pipe","Filter2","constructor","pipe","activeFilterTimeout","whileCondition","passiveFilterData","data","sleep","ms","Promise","resolve","setTimeout","activeFilterData","pipedData","popElement","alert","pushElement"],"mappings":";;;;;;AAAOA,U;;;;;;;;;;;AAAAA,+C;;;;;;;AAEQ,YAAMC,OAAN,CAAc;;AAE3BC,sBAAc;AACZ,eAAKC,IAAL,GAAY,IAAIH,IAAJ,EAAZ;AACA,eAAKI,mBAAL,GAA2B,IAA3B;AACA,eAAKC,cAAL,GAAsB,IAAtB;AAED;;AAGDC,0BAAkBC,IAAlB,EAAwB;AACtB;AACA,iBAAOA,IAAP;AACD;;AAEDC,cAAMC,EAAN,EAAU;AACR,iBAAO,IAAIC,OAAJ,CAAYC,WAAWC,WAAWD,OAAX,EAAoBF,EAApB,CAAvB,CAAP;AACD;;AAED,cAAMI,gBAAN,GAAyB;AACvB,iBAAO,KAAKR,cAAZ,EAA4B;;AAE1B,gBAAIS,YAAY,KAAKX,IAAL,CAAUY,UAAV,EAAhB;;AAEA,gBAAID,SAAJ,EAAe;AACbE,oBAAMF,SAAN;AACD,aAFD,MAEO;AACL,mBAAKX,IAAL,CAAUc,WAAV,CAAsB,KAAtB;AACD;AACD,kBAAM,KAAKT,KAAL,CAAW,KAAKJ,mBAAhB,CAAN;AACD;AACF;;AA/B0B;;yBAARH,O;;;;;;;;6BAAAA,wC","file":"filter2.js","sourcesContent":["import Pipe from \"./pipe.js\"\n\nexport default class Filter2 {\n  \n  constructor() {\n    this.pipe = new Pipe();\n    this.activeFilterTimeout = 5000;\n    this.whileCondition = true;\n\n  }\n  \n  \n  passiveFilterData(data) {\n    // do some filtering with the data\n    return data\n  }\n  \n  sleep(ms) {\n    return new Promise(resolve => setTimeout(resolve, ms));\n  }\n  \n  async activeFilterData() {\n    while (this.whileCondition) {\n      \n      var pipedData = this.pipe.popElement();\n      \n      if (pipedData) {\n        alert(pipedData)\n      } else {\n        this.pipe.pushElement(\"neu\");\n      }\n      await this.sleep(this.activeFilterTimeout)\n    }\n  }\n           \n\n  \n}"]}