VimUnDo|Z4, "Lw~,zWM]r ;;;;PytX_P5_Pvar send = require5_Pvar send = require()5_Pvar send = require("")5_Pvar send = require(".")5_P2exports['test:add listeners'] = function(assert) {5_ P5_ Pvar event = require()5_ Pvar event = require("")5_ P var e = new EventEmitter();5_ P var e = event();5_ P & var events_new_listener_emited = [];5_  P  var emitted = [];5_  P  var actual = [];5_ P  var times_hello_emited = 0;5_ P  var times = 0;5_ P  var times = 05_P5_Pvar watch = require()5_Pvar watch = require("")5_Pvar watch = require("../watch")5_P&var watch = require("watchabel/watch")5_%vP5_ %vP&var watch = require("watchable/watch")5_&%vP(var unwatch = require("watchable/watch")5_ %vP  5_ %vP  watch()5_ %vP  watch(e, function())5_ %vP  watch(e, function() {})5_ %vP 5_  %vP  watch(e, function() {5_! %vP 5_ "!%vP  actual.push()5_!#"%vP  watch(e, function(data) {actual.push(data)  actual.push(data)5_"$#%vP - watch(e, function(data) { actual.push(data)})  })5_#%$%vP 2 e.on("newListener", function (event, listener) {5_$&%%vP  + events_new_listener_emited.push(event);5_%'&%vP   });5_&('%vP  5_')(%vP  ! e.on("hello", function (a, b) {5_(*)%vP   times_hello_emited += 1;5_)+*%vP  6 assert.equal("a", a, "first argument was passed");5_*,+%vP  8 assert.equal("b", b, "secrond argument was passed");5_+-,%vP  I assert.equal(this, e, '`this` pseudo-variable is bound to instance');5_,.-%vP   });5_-/.%vP e.emit("hello", "a", "b");5_.0/%vP! send(e.emit("hello", "a", "b");5_/10%vP send(e, "hello", "a", "b");5_021%vP 5_132%vP send()5_243%vP send("")5_354 %vP send(e, "")5_465%vP};5_576%vP assert.deepEqual 5_687%vP' assert.deepEqual()5_798%vP, assert.deepEqual(actual, [])5_8:9%vP-! assert.deepEqual(actual, [ ""])5_9;:$%vP.& assert.deepEqual(actual, [ "hello"])5_:<;'%vP0* assert.deepEqual(actual, [ "hello", ""])5_;=<%vP3 / assert.deepEqual(actual, [ "hello", "world"])5_<>=-%vP6. assert.deepEqual(actual, ["hello", "world"])5_=?>0%vP6 2 assert.deepEqual(actual, ["hello", "world"], "")5_>@?%vPI e.emit('foo', 'baz'); e.emit('foo', 'bar');! e.once('foo', function(value) {)exports['test:once'] = function(assert) {@ assert.ok(reported, 'error should be reported through event'); e.emit('boom', 3);9 e.on('boom', function() { throw new Error('Boom!'); });2 e.on('error', function(e) { reported = true; });Kexports['test:errors are reported if listener throws'] = function(assert) {{}9exports['test:adding same listener'] = function(assert) {wyM assert.equal('callback3', callbacks_called[1], "callback3 was called 2nd");vxM assert.equal('callback2', callbacks_called[0], "callback2 was called 1st");egJ assert.equal('callback3', callbacks_called[2], "callback3 is still #3");dfJ assert.equal('callback2', callbacks_called[1], "callback2 is still #2");ceJ assert.equal('callback1', callbacks_called[0], "callback1 is still #1");]_0 assert.equal('callback3', callbacks_called[2],[]0 assert.equal('callback2', callbacks_called[1],Y[0 assert.equal('callback1', callbacks_called[0],SU0 assert.equal('callback1', callbacks_called[0],9;4exports['test: modify in emit'] = function(assert) {68P assert.equal(listener2, e3.listeners('hello')[0], "correct listener remains");57K assert.equal(1, e3.listeners('hello').length, "one listener is removed");35K assert.equal(2, e3.listeners('hello').length, "one more listener added");13P assert.equal(1, e3.listeners('hello').length, "only one listener registered");,.3 assert.equal(listener1, e2.listeners('hello')[0],+-N assert.equal(1, e2.listeners('hello').length, "anther listener registered");)+O assert.equal(1, e2.listeners('hello').length, "one listener was registered");%'N assert.equal(0, e1.listeners('hello').length, "only listenere was removed");#%N assert.equal(1, e1.listeners('hello').length, "one listener is registered");5exports['test:remove listeners'] = function(assert) { 2exports['test add listeners'] = function(assert) {5_?A@%vPM  2exports["test add listeners"] = function(assert) {5_@BA%vPR 5exports["test:remove listeners"] = function(assert) {5_ACB%vP`5_BDCvPd!5_CED/vPg 0exports["test watch event"] = function(assert) { var e = event() var actual = []0 watch(e, function(data) { actual.push(data) }) send(e, "hello", "a", "b") send(e, "world")M assert.deepEqual(actual, ["hello", "world"], "two values send to an event")}5_DFEvPh/exports["test watch event"] = function(assert) 5_EGFvPh 5_FHGvPj2exports["test unwatch event"] = function(assert) {5_GIHvPn/exports["test fifo event"] = function(assert) {5_HJIvPp/exports["test FIFO event"] = function(assert) {5_IKJvP 5_JLKvP€5_KML vP„ 0exports["test watch event"] = function(assert) {5_LNM vP‡ 2exports["test send on event"] = function(assert) {5_MON vP‰ 6exports["test send on unwatched"] = function(assert) {5_NPO  vP  var actual = []5_OVP vPŽ 5_PWQV   vPž  send(e, "hello", "a", "b") send(e, "world")5_VXW   vPŸ  5_WYXvP¢ send(e, "world")5_XZY vP¨ 5_Y[Z vP© 5_Z\[vPª   5_[]\vP± &(6 function watcher3(value) { actual.push(value + "#3")5_(%8%vP@'( actual.push(value + "#3")5_(%8%vP@'( }5_)%8%vPC(* var e1 = new EventEmitter();5_)%8%vPE(* var e1 = event();5_)%8%vPI)+ )+5_*%8%vPK)+ watch()5_*%8%vPR*,5_*%8%vPW)+ watch(e1, listener1)5_$%8%vPc$&$&5_%&8&vPi$& function watcherSideEffect()5_% &8&vPj$'! function watcherSideEffect() {}5_%'8'vPk%'5_%(8(vPp$& function watcherSideEffect() {5_&(8(vPq%'5_&(8(vPv%' 5_&(8(vP%' wat5_&(8(vPÁ%' wat5_& (8(vPÃ%' watch()5_&(8(vPÈ%' unwatch())5_& (8(vPÉ%' unwatch()5_& (8(vPË%' unwatch(watcher1)5_#(8(vPÔ#% #%5_')8)vPØ') ')5_( *8*vPÜ') watch()5_'*8*vPì') ')5_( +8+vPï') unwatch()5_/+8+vPõ./ var e1 = event()5_/+8+vPö./ watch(e1, watcher1)5_/+8+vPø./5_/+8+vPø./ e1.on("hello", listener1);5_/+8+vPù./N assert.equal(1, e1.listeners("hello").length, "one listener is registered");5_/+8+vPù./( e1.removeListener("hello", listener1);5_/+8+vPù./N assert.equal(0, e1.listeners("hello").length, "only listenere was removed");5_/+8+vPù./5_/+8+vPù./ var e2 = new EventEmitter();5_/+8+vPù./ e2.on("hello", listener1);5_/+8+vPú./O assert.equal(1, e2.listeners("hello").length, "one listener was registered");5_/+8+vPú./( e2.removeListener("hello", listener2);5_/+8+vPú./N assert.equal(1, e2.listeners("hello").length, "anther listener registered");5_/+8+vPú./3 assert.equal(listener1, e2.listeners("hello")[0],5_/+8+vPú./5 "order of registration is preserved");5_/+8+vPú./5_/+8+vPû./ var e3 = new EventEmitter();5_/+8+vPû./ e3.on("hello", listener1);5_/+8+vPû./P assert.equal(1, e3.listeners("hello").length, "only one listener registered");5_/+8+vPû./ e3.on("hello", listener2);5_/+8+vPû./K assert.equal(2, e3.listeners("hello").length, "one more listener added");5_/+8+vPû./( e3.removeListener("hello", listener1);5_/+8+vPü./K assert.equal(1, e3.listeners("hello").length, "one listener is removed");5_/+8+vPü./P assert.equal(listener2, e3.listeners("hello")[0], "correct listener remains");5_/+8+vPþ.0};5_.+8+vPÿ.0.05_/ +8+vP.0 second()5_/+8+vP.0 send()5_/ +8+vP.0 send(e, "")5_/ +8+vP/1 /15_0+8+vP/1 send()5_0 +8+vP/1 send(e, "")5_.+8+vP.0.05_/+8+vP.0 watch()5_/+8+vP/1 /15_0+8+vP/1 watch()5_1 +8+vP13 135_2+8+vP13 watch()5_2+8+vP245_3+8+vP235_3+8+vP35 355_4+8+vP35 send()5_4 +8+vP35 send(e, "")5_4 +8+vP46 465_5+8+vP46 send()5_& +8+vP&( &(5_',8,vP&( actual.pusd()5_',8,vP&( actual.push()5_',8,vP&( actual.push("")5_',8,vP &( actual.push(value + "")5_&,8,vP%'! function watcherSideEffect1() {5_6 ,8,vP57 send(c, "")5_6,8,vP57 send(c, "d")5_6,8,vP79 assert.deepEqual69 685_8,8,vP79 assert.deepEqual()5_8,8,vP7: assert.deepEqual(actual, [])5_9,8,vP 8:])5_8,8,vP!8: 8:5_9,8,vP&8: ""5_9 ,8,vP)8: "a#1"5_9 ,8,vP*8: "a#1", ""5_9,8,vP.8: "a#1", "a#2"5_9,8,vP48: "a#1", "a#2", ""5_9,8,vP78: "a#1", "a#2", "b#1"5_9,8,vP88: "a#1", "a#2", "b#1", ""5_9,8,vP<8: "a#1", "a#2", "b#1", "b#2"5_9!,8,vPC8:" "a#1", "a#2", "b#1", "b#2", ""5_9#,8,vPQ8:% "a#1", "a#2", "b#1", "b#2", "b#3"5_9%,8,vPR8:% "a#1", "a#2", "b#1", "b#2", "b#@"5_(,8,vPe') unwatch(e, watcher1)5_111vPk02 watch(e, watcher2)5_111vPl01 5_211vPm24 245_911vPr8:' "a#1", "a#2", "b#1", "b#2", "b#@", 5_911vPw8: "a#1", "b#1", "b#2", "b#@", 5_911vPz8:$ "a#1", "b#1", "b#@"b#2", "b#@", 5_911vP{8:& "a#1", "b#1", "b#@", b#2", "b#@", 5_911vPĐ8:' "a#1", "b#1", "b#@", "b#2", "b#@", 5_911vPĒ8:' "a#1", "b#1", "b#@", "c#2", "b#@", 5_9!11vPĖ8:' "a#1", "b#1", "b#@", "c#1", "b#@", 5_9#11vPę8:' "a#1", "b#1", "b#@", "c#1", "c#@", 5_9&11vPě8:' "a#1", "b#1", "b#@", "c#1", "c#3", 5_9(11vPĜ8:* "a#1", "b#1", "b#@", "c#1", "c#3", "" 5_9-11vPġ8:- "a#1", "b#1", "b#@", "c#1", "c#3", "d#1" 5_9/11vPĢ8:0 "a#1", "b#1", "b#@", "c#1", "c#3", "d#1", ""5_9311vPĨ8:3 "a#1", "b#1", "b#@", "c#1", "c#3", "d#1", "d#2"5_911vPī79 assert.deepEqual(actual, [1"a#1", "b#1", "b#@", "c#1", "c#3", "d#1", "d#2" ]8:5 "a#1", "b#1", "b#@", "c#1", "c#3", "d#1", "d#2" ]5_8M11vPĭ79M assert.deepEqual(actual, ["a#1", "b#1", "b#@", "c#1", "c#3", "d#1", "d#2" ]5_8M11vPį8: 8:5_911vPķ8: ""5_9811vPĿ8:8 "events are dispatched in FIFO order"5_:11vPĿ9: ])5_<11vP;<4exports["test: modify in emit"] = function(assert) {5_<11vP;< var callbacks_called = [ ];5_<11vP;< var e = new EventEmitter();5_<11vP;<5_<11vP;< function callback2() {5_<11vP;<' callbacks_called.push("callback2");5_<11vP;<' e.removeListener("foo", callback2);5_<11vP;< }5_<11vP;< function callback3() {5_<11vP;<' callbacks_called.push("callback3");5_<11vP;<' e.removeListener("foo", callback3);5_<11vP;< }5_<11vP;< function callback1() {5_<11vP;<' callbacks_called.push("callback1");5_<11vP;< e.on("foo", callback2);5_ <11vP;< e.on("foo", callback3);5_  <11vP;<' e.removeListener("foo", callback1);5_   <11vP;< }5_   <11vP;< 5_   <11vP;< e.on("foo", callback1);5_  <11vP;<K assert.equal(1, e.listeners("foo").length, "one listener is registered");5_ <11vP;<5_<11vP;< e.emit("foo");5_<11vP;<, assert.equal(2, e.listeners("foo").length,5_<11vP;<: "listener registered additional listener");5_<11vP;<N assert.equal(1, callbacks_called.length, "listener was called only 1 time");5_<11vP;<0 assert.equal("callback1", callbacks_called[0],5_<11vP;<0 "callback1 listener was called");5_<11vP;<5_<11vP;< e.emit("foo");5_<11vP;<K assert.equal(0, e.listeners("foo").length, "listeners removed themself");5_<11vP;<O assert.equal(3, callbacks_called.length, "all of the listeners were called");5_<11vP;<0 assert.equal("callback1", callbacks_called[0],5_<11vP;<- "callback1 was called first");5_<11vP;<0 assert.equal("callback2", callbacks_called[1],5_<11vP;<. "callback2 was called second");5_<11vP;<0 assert.equal("callback3", callbacks_called[2],5_<11vP;<- "callback3 was called third");5_ <11vP;<5_! <11vP;< e.emit("foo");5_ "!<11vP;<K assert.equal(0, e.listeners("foo").length, "no listener are registered");5_!#"<11vP;<G assert.equal(3, callbacks_called.length, "no listeners were called");5_"$#<11vP;<J assert.equal("callback1", callbacks_called[0], "callback1 is still #1");5_#%$<11vP;<J assert.equal("callback2", callbacks_called[1], "callback2 is still #2");5_$&%<11vP;<J assert.equal("callback3", callbacks_called[2], "callback3 is still #3");5_%'&<11vP;<5_&('<11vP;< e.on("foo", callback1);5_')(<11vP;< e.on("foo", callback2);5_(*)<11vP;<I assert.equal(2, e.listeners("foo").length, "two listeners were added");5_)+*<11vP;< e.removeAllListeners("foo");5_*,+<11vP;<K assert.equal(0, e.listeners("foo").length, "all listeners were removed");5_+-,<11vP;<5_,.-<11vP;<N // Verify that removing callbacks while in emit allows emits to propagate to5_-/.<11vP;< // all listeners5_.0/<11vP;< callbacks_called = [ ];5_/10<11vP;<5_021<11vP;< e.on("foo", callback2);5_132<11vP;< e.on("foo", callback3);5_243<11vP;<H assert.equal(2, e.listeners("foo").length, "two liseners were added");5_354<11vP;< e.emit("foo");5_465<11vP;<H assert.equal(2, callbacks_called.length, "two listeners were called");5_576<11vP;<M assert.equal("callback2", callbacks_called[0], "callback2 was called 1st");5_687<11vP;<M assert.equal("callback3", callbacks_called[1], "callback3 was called 2nd");5_798<11vP;<L assert.equal(0, e.listeners("foo").length, "listeners romeved themselfs");5_8:9<11vP;<};5_9;:<11vP;<5_:<;<11vP;=^9exports["test:adding same listener"] = function(assert) {5_;=<<11vP;=^;exports["test same wot same listener"] = function(assert) {5_<>=<11vP;=^?exports["test same watcher same listener"] = function(assert) {5_=?><11vP;=^@exports["test start watcher same listener"] = function(assert) {5_>@?<11vP;=^>exports["test start watch same listener"] = function(assert) {5_?A@<*11vP;=^Aexports["test start watch several listener"] = function(assert) {5_@BA=11vP<= function foo() {}5_ACB<11vP<>^ <>]5_BDC=11vP<>^ var watcher5_CED=11vP<>^ function watcher5_DFE=11vP<>^ function watcher()5_EGF=11vP<>^ function watcher() 5_FHG=11vP<>^ function watcher() {}5_GIH=#11vP<>^% function watcher() { actual.push()}5_HJI=$11vP<>^' function watcher() { actual.push("")}5_IKJ=+11vP<>^, function watcher() { actual.push("value")}5_JLK=*11vP<>^- function watcher() { actual.push("value") }5_KML=11vP<>^+ function watcher() { actual.push(value) }5_LNM<11vP<>_ <>^5_MON=11vP=?` =?_5_NPO?11vP ?A`5_OQPA11vP@A var e = new EventEmitter();5_PRQA11vP@A e.on("foo", foo);5_QSRA11vP@A e.on("foo", foo);5_RTSA11vP@A assert.equal(5_SUTA11vP@A 1,5_TVUA11vP@A e.listeners("foo").length,5_UWVA11vP@A( "listener reregistration is ignored"5_VXWA11vP@A );5_WYXA11vP@BY};5_XZY@11vP@BZ@BY5_Y[Z?-11vP>@Z0 function watcher(value) { actual.push(value) }5_Z\[?111vP>@Z5 function watcher(value) { actual.push(value + "") }5_[]\?11vP">@Z7 function watcher(value) { actual.push(value + "#1") }5_\^]???8vP%?B[ ?AZ5_]_^@??8vP'?A\8 function watcher1(value) { actual.push(value + "#1") }5_^`_@3??8vP)?A\8 function watcher2(value) { actual.push(value + "#1") }5__a`@3??8vP+?A]8 function watcher2(value) { actual.push(value + "#2") }@B] @B\5_`baA??8vP.@A5_acbB??8vP2AC[ watch()5_bdcB??8vP6CE sendAE[ watch(e, watcher1)5_cedD??8vP<CE] send()5_dfeD ??8vP>CE] send(e, "")5_egfD ??8vPAEG watchDG^ DF]5_fhgF??8vPCEG_ watch()5_gihF??8vPHGI sendFI` FH_5_hjiH??8vPJGIa send()5_ikjH ??8vPKGIa send(e, "")5_jlkH ??8vPLIK watchHKb HJa5_kmlJ??8vPPIKc watch()5_lnmJ??8vPWJL watchILc watch(e, watcher2)5_monK??8vPYJLd watch()5_npoK??8vP_LN sendKNe KMd5_oqpM??8vPaLNf send()5_prqM ??8vPcLNf send(e, "")5_qsrM ??8vPdMPg MOf5_rtsO??8vPlNPh watch5_sutO ??8vPpNPh unwatch()5_tvuO??8vPqNPh unwatch(e, "")5_uwvO??8vPsNPh unwatch(e, "d")5_vxwO??8vPyNPh unwatch(e, watcher)5_wyxO??8vPzPR sendORi OQh5_xzyQ??8vP|PRj send()5_y{zQ ??8vP}PRj send(e, "")5_z|{Q ??8vP~RT watchQTk QSj5_{}|S??8vPńRTl watch()5_|~}S??8vPŌTV sendSVm SUl5_}~U??8vPŎTVn send()5_~U ??8vPőTVn send(e, "")5_U??8vPœVX watchTXn send(e, "e")5_W??8vPŕVXp watch()5_W??8vPŚXZ sendWZq WYp5_Y??8vPśXZr send()5_Y ??8vPŞXZr send(e, "")5_Y ??8vPšZ\ watchY\s Y[r5_[??8vPŧZ\t watch()5_[??8vPŮ\^ send[^u []t5_]??8vPų\^v send()5_] ??8vPŵ\^v send(e, "")5_] ??8vPŶ^` unwatch]`w ]_v5__ ??8vPŽ^`x unwatch()5____vP_ay _ax5_`__vP_ay unwatch(e, watcher2)5_`__vP`bz `by5_a __vP`bz unwatch()5_aaavPac{ acz5_baavPbe| bd{5_daavPce}5_daavPce} send()5_daavPce} send("")5_d aavPce} send(e, "")5_d aavPeg assert.deepEqualdg~ df}5_faavPeg assert.deepEqual()5_faavPeg assert.deepEqual(actual, {})5_faavPeh assert.deepEqual(actual, [])5_gaavPfh])5_f aavPfh5_gaavPfh5_gaavPfh ""5_g aavPfh "a#1"5_g aavPfh "a#1", ""5_gaavPfh "a#1", "b#1"5_gaavPfh "a#1", "b#1", ""5_gaavP fh "a#1", "b#1", "c#1"5_gaavP fh "a#1", "b#1", "c#1", ""5_gaavPfh "a#1", "b#1", "c#1", "c#1"5_gaavPfh "a#1", "b#1", "c#1", "c#2"5_g!aavPfh" "a#1", "b#1", "c#1", "c#2", ""5_g%aavPfh% "a#1", "b#1", "c#1", "c#2", "d#1"5_g(aavP"fh) "a#1", "b#1", "c#1", "c#2", "d#1", ""5_g,aavP-fh, "a#1", "b#1", "c#1", "c#2", "d#1", "e#2"5_g/aavP0fh0 "a#1", "b#1", "c#1", "c#2", "d#1", "e#2", ""5_g3aavP3fh3 "a#1", "b#1", "c#1", "c#2", "d#1", "e#2", "f#2"5_g6aavP4fh7 "a#1", "b#1", "c#1", "c#2", "d#1", "e#2", "f#2", ""5_g:aavP9fh: "a#1", "b#1", "c#1", "c#2", "d#1", "e#2", "f#2", "f#1"5_eg<ev P<cf send(e, "h")df5_g<g<dv P@fh< "a#1", "b#1", "c#1", "c#2", "d#1", "e#2", "f#2", "f#1", 5_g=g<dv PCfh> "a#1", "b#1", "c#1", "c#2", "d#1", "e#2", "f#2", "f#1", ""5_gAg<dv PFfhA "a#1", "b#1", "c#1", "c#2", "d#1", "e#2", "f#2", "f#1", "g#2"5_gDg<dv PGfhE "a#1", "b#1", "c#1", "c#2", "d#1", "e#2", "f#2", "f#1", "g#2", ""5_hg<dv PJgi ])5_hg<dv PLgi ], "")5_hg<dv PPgi ], "events dispatched")5_hg<dv PYgi ], "mulitple watch ")5_hg<dv P]gi ], "subsequent watch ")5_h#g<dv Pagi% ], "subsequent watch & unwatches ")5_Kg<dv PiKM KM5_L h<ev PlKM unwatch()5_Lh<ev PnKM unwatch(e, function())5_llv PxkmmekmKexports["test:errors are reported if listener throws"] = function(assert) { var e = new EventEmitter(), reported = false;2 e.on("error", function(e) { reported = true; });9 e.on("boom", function() { throw new Error("Boom!"); }); e.emit("boom", 3);@ assert.ok(reported, "error should be reported through event");};)exports["test:once"] = function(assert) { var e = new EventEmitter(); var called = false;! e.once("foo", function(value) {4 assert.ok(!called, "listener called only once");> assert.equal(value, "bar", "correct argument was passed"); }); e.emit("foo", "bar"); e.emit("foo", "baz");};5_lllv Pykle5_lllv Pzkrequire("test").run(exports);5_llv Pl&var watch = require("watchable/watch")5_ llv Pl*var unwatch = require("watchable/unwatch")5_81  vPȪ79lN assert.deepEqual(actual, ["a#1", "b#1", "b#@", "c#1", "c#3", "d#1", "d#2" ],5_86  vPȬ79lR assert.deepEqual(actual, ["a#1", "b#1", "b#@", "b#2"c#1", "c#3", "d#1", "d#2" ],5_8  vPȲ7:lU assert.deepEqual(actual, ["a#1", "b#1", "b#@", "b#2", "c#1", "c#3", "d#1", "d#2" ],5_9;  vPȴ8;m= "a#1", "b#1", "b#@", "b#2", "c#1", "c#3", "d#1", "d#2" ],5_;  vPȶ9;n ],&"events are dispatched in FIFO order"):<n9 "events are dispatched in FIFO order")5_98  vP8:m: "a#1", "b#1", "b#@", "b#2", "c#1", "c#3", "d#1", "d#2"5_i#  vP hjmH "a#1", "b#1", "c#1", "c#2", "d#1", "e#2", "f#2", "f#1", "g#2", "g#1"5_ Pm'var watch = require("watchables/watch")5_$Pm,var accumulate = require("watchables/watch")5_(Pm*var accumulate = require("reducers/watch")5_P!+var unwatch = require("watchables/unwatch")5_Pml5_ Pmvar assert = require()5_Pmvar test = require()5_P"mvar test = require("")5_P m0exports["test watch event"] = function(assert) {5_Pm}5_P m5exports["test watch event"] = test(function(assert) {5_P m8exports["test reducers event"] = test(function(assert) {5_P/var accumulate = require("reducers/accumulate")5_ P  var actual = []5_ P l k5_ P l assert()5_ P l assert(e, [])5_ P l assert(e, [""])5_ P l assert(e, ["hello"])5_ P l assert(e, ["hello", ""])5_ P l assert(e, ["hello", "world"])5_ !P l# assert(e, ["hello", "world"], "")5_ P 5_ P 0 watch(e, function(data) { actual.push(data) })5_P#M assert.deepEqual(actual, ["hello", "world"], "two values send to an event")5_%P$i=61C1vP56;exports["test FIFO dispatch on event"] = function(assert) {5_=?>61C1vP56 var actual = []5_>@?61C1vP56 var e = event()5_?A@61C1vP565_@BA61C1vP56& function watcherSideEffect1(value) {5_ACB61C1vP56 actual.push(value + "#@")5_BDC61C1vP56 unwatch(e, watcher2)5_CED61C1vP56" unwatch(e, watcherSideEffect1)5_DFE61C1vP56 watch(e, watcher3)5_EGF61C1vP56 }5_FHG61C1vP568 function watcher1(value) { actual.push(value + "#1") }5_GIH61C1vP568 function watcher2(value) { actual.push(value + "#2") }5_HJI61C1vP568 function watcher3(value) { actual.push(value + "#3") }5_IKJ61C1vP565_JLK61C1vP56 watch(e, watcher1)5_KML61C1vP56 send(e, "a")5_LNM61C1vP56 watch(e, watcherSideEffect1)5_MON61C1vP56 watch(e, watcher2)5_NPO61C1vP56 send(e, "b")5_OQP61C1vP56 send(e, "c")5_PRQ61C1vP56 send(e, "d")5_QSR61C1vP565_RTS61C1vP56 assert.deepEqual(actual, [5_SUT61C1vP57j+ ], "events are dispatched in FIFO order")56: "a#1", "b#1", "b#@", "b#2", "c#1", "c#3", "d#1", "d#3"5_TVU61C1vP56+ ], "events are dispatched in FIFO order")5_UWV61C1vP56}5_VXW51C1vP45/*5_WYX51C1vP455_XZYd1C1vPcd*/5_Y[Z66b0vP578 }57e. var e = event() var actual = []8 function watcher1(value) { actual.push(value + "#1") }8 function watcher2(value) { actual.push(value + "#2") } watch(e, watcher1) send(e, "a") watch(e, watcher1) send(e, "b") watch(e, watcher2) watch(e, watcher1) unwatch(e, function() {}) send(e, "c") unwatch(e, watcher1) send(e, "d") watch(e, watcher2) send(e, "e") watch(e, watcher1) send(e, "f") watch(e, watcher1) send(e, "g") unwatch(e, watcher2) unwatch(e, watcher2) unwatch(e, watcher1) unwatch(e, watcher1) send(e, "h") assert.deepEqual(actual, [H "a#1", "b#1", "c#1", "c#2", "d#2", "e#2", "f#2", "f#1", "g#2", "g#1"0 ], "subsequent watch & unwatches are ignored")}5_Z\[6661vP578 }5_[]\5'661vP5468>exports["test start watch several times"] = function(assert) {5_\^]661vP985_]_^771vP9var into = require()5_^`_771vP69var into = require("")5__a`6 771vP579:exports["test can be reduced by one"] = function(assert) {5_`ba6$771vP75795_ikj; ==1vP:8:<? into()5_jlk<==1vP?;=? })5_kml<==1vPA;=? }, "")5_lnm<==1vPJ;=?' }, "throws on subsequent reductions")5_mon<%==1vPN9;=?' }, "throws on attempt to reductions")5_npo</==1vP[<?@ <>?5_oqp???1vP^>@A}5_prq6+??1vPa57A=exports["test can be reduced only once"] = function(assert) {5_qsr=??1vPd=?B=?A5_rts>@@1vPg=?B send()5_sut> @@1vPh>@C >@B5_tvu?AA1vPl>@C send()5_uwv? AA1vPn?BD ?AC5_vxw@CC1vPv?@5_wyx@BB1vPv?@ assert5_xzy?AA1vPw?AD ?AC5_y{z@BB1vPy?AD send()5_z|{@BB1vP?AD send(end)5_{}|@ BB1vP@CE @BD5_|~}A:<vPAEGACF5_}~B:<vPACIassert.throws(function() {5_~D:<vPCEI },5_D:<vPCEI }, ""5_D/:<vP:CEI/ }, "throws on attempt reduce after close too"5_E:<vPEGJEGI5_8:<vP79J var a = into(e)5_F :<vPEGJ assert()5_F:<vPEGJ assert(actual, [])5_F:<vPEGJ assert(actual, [ 1, 2])5_F:<vPEGJ assert(actual, [1, 2])5_F:<vP;EGJ assert(actual, [1, 2], "")5_C:<vPBDJ into(e)5_C:<vPBDJ assert.deepEqual(into(e)5_C :<vPBDJ assert.deepEqual(into(e), []5_C#:<vPBDJ$ assert.deepEqual(into(e), [], ""5_C@:<vP=BDJ@ assert.deepEqual(into(e), [], "read after end returns empty"5_B:<vPAB assert.throws(function() {5_C:<vPBC0 }, "throws on attempt reduce after close too")5_B:<vP>ACHA assert.deepEqual(into(e), [], "read after end returns empty")5_:<vPk I H5_ ;=vPr Ivar concat = require()5_ ;=vPr? Ivar concat = require("")5_G;=vP|HJexportsGJJGII5_I;=vPHJK exports[]5_I ;=vPHJK exports[""]5_I!;=vPHJK!exports["test concat with event"]5_I);=vPHJK*exports["test concat with event"] = test()5_I2;=vPHJK4exports["test concat with event"] = test(function())5_I9;=vPHJK:exports["test concat with event"] = test(function(assert))5_I;;=vPHKK=exports["test concat with event"] = test(function(assert) {})5_I;=vPIKM IKL5_J;=vPJLN JLM5_K;=vPLN var fixture = concatKNO KMN5_M;=vPLNP var fixture = concat()5_M;=vPLNP var fixture = concat(left, [])5_M(;=vPLNP) var fixture = concat(left, [ 1, 2, 3 ])5_M.;=vPNP sendMPQ MOP5_O;=vPNPR send()5_M;=vPLNR0 var fixture = concat(left, [ 1, 2, 3 ], right)5_M";=vPLNR0 var fixture = concat(left, [ 5, 2, 3 ], right)5_M%;=vPLNR0 var fixture = concat(left, [ 5, 6, 3 ], right)5_O ;=vPOQS OQR5_P;=vPOQS send()5_P;=vPOQS send(right, )5_P;=vPQS sendPST PRS5_R;=vPQSU send()5_R ;=vPQSU send(le)5_R ;=vPQSU assert()5_M ;=vPLNU0 var fixture = concat(left, [ 5, 6, 7 ], right)5_R;=vPQSU assert(fixture)5_R;=vPQSU assert(actual, [])5_R;=vPQSU assert(actual, [ 1, 2, 3, 5,])5_R;=vPQSU+ assert(actual, [ 1, 2, 3, 5, 6, 7, 9, 0])5_R;=vPQSU+ assert(actual, [ 1, 2, 3, 4, 6, 7, 9, 0])5_R,;=vPQSU. assert(actual, [ 1, 2, 3, 4, 5, 6, 7, 9, 0])5_R%;=vPQSU+ assert(actual, [ 1, 2, 3, 4, 5, 6, 7, 9])5_M%;=vPLNU/ var actual = concat(left, [ 5, 6, 7 ], right)5_M;=vPLNU, var actual = concat(left, [ 5, 6 ], right)5_O ;=vP"NPU send(left, 0)5_P;=vP%OQU send(right, 8)5_R;=vP(QSU+ assert(actual, [ 1, 2, 3, 4, 5, 6, 8, 9])5_R;=vP+SU sendRUV RTU5_T;=vP-SUW send()5_T ;=vP8TVX TVW5_U;=vP9TVX send()5_R$;=vP>QSX( assert(actual, [ 2, 3, 4, 5, 6, 8, 9])5_R#;=vP@QSX% assert(actual, [ 2, 3, 4, 5, 6, 9])5_U;=vPDUWY UWX5_V;=vPFUWY send()5_V ;=vPIVXZ VXY5_W;=vPKVXZ send()5_W;=vPLWY[ WYZ5_X;=vPOWY[ send()5_S;=vPSRT[5_S;=vPVRT[`5_R&;=vPXQS[( assert(actual, [ 2, 3, 4, 5, 6, 9, 0])5_R;=vP\QS[% assert(actual, [ 2, 3, 4, 5, 6, 9])5_X;=vP^XZ\ XZ[5_Y;=vP`XZ\ send()5_R#;=vPeQS\$ assert(actual, [2, 3, 4, 5, 6, 9])5_R&;=vPf@QS\( assert(actual, [2, 3, 4, 5, 6, 9], "")5_:;=vPm:<]:<\5_;<>vP:; var into()5_:;=vP:<]:<\5_;<>vP:<] var errored = into()5_<<>vP;< assert.throws(function() {5_<<=vP;< into(e)5_<<<vP;<2 }, "throws on attempt to reduce more then once")5_:<<vP9:5_C;;vPBC5_B ;;vPACX7 assert(actual, [1, 2], "send vales were accumulated")5_B;;vPACX> assert(concat(actual, [1, 2], "send vales were accumulated")5_B ;;vPACXG assert(concat(actual, errored) [1, 2], "send vales were accumulated")5_B";;vPADXH assert(concat(actual, errored), [1, 2], "send vales were accumulated")5_C;;vPBDY/ [1, 2], "send vales were accumulated")5_C;;vPABDY8 [1, 2, Error()], "send vales were accumulated")5_C4;;vPBBEYR [1, 2, Error("Event is already reduced")], "send vales were accumulated")5_B!;;vPACZ! assert(concat(actual, errored),5_B#;;vPADZ$ assert(concat(actual, errored), {}5_B;;vPBD\ BD[5_C ;;vPBD\ vales: []5_C;;vPBE\ vales: [1, 2]5_F;;vPCE\ error#Error("Event is already reduced")],DF] }#Error("Event is already reduced")],EG]3 [1, 2, Error("Event is already reduced")],5_D.;;vPCF[. error: Error("Event is already reduced")],5_F ;;vPCDF\ }"send vales were accumulated")EG\' "send vales were accumulated")5_C;;vPEBD[ vales: [1, 2],5_) ) ) v Pa(-[4 assert(e, [], "event ended bofore it was reduced")5_*) ) v PeG)+^ values: [1, 2],5_\) ) v P]_exports\__\^^5_^) ) v P]_` exports[]5_^ ) ) v P]_` exports[""]5_^) ) v P]_`exports["test errors"]5_^) ) v P]_`exports["test errors"] = test()5_^') ) v P]_`)exports["test errors"] = test(function())5_^.) ) v P]_`/exports["test errors"] = test(function(assert))5_^0) ) v P]``2exports["test errors"] = test(function(assert) {})5_^) ) v P^`b ^`a5__) ) v P_ac _ab5_`) ) v Pac send`cd `bc5_b) ) v Pace send()5_`) ) v P_ae var actual = event()5_`) ) v P_ae var actual = into()5_b ) ) v Pace send(e, )5_b ) ) v Pbdf bde5_c) ) v Pbdf send()5_c ) ) v Pceg cef5_d) ) v Pceg send()5_d) ) v Pceg send(e, Error())5_d) ) v Pceg send(e, Error(""))5_d) ) v Pdgh dfg5_f67DvPeii5_f67DvPegkBassert.ok(isReduced(send(e, 2)), "ended returns reduced on value")5_f67DvPHegkD assert.ok(isReduced(send(e, 2)), "ended returns reduced on value")5_fB67DvPegkD assert.ok(isReduced(send(e, 3)), "ended returns reduced on value")5_gBfCf=v=PIfhkD assert.ok(isReduced(send(e, end)), "ended returns reduced on end")5_gEfCf=v=Phj assertgjl gik5_i fCf=v=Phjm assert()5_ ifCf=v=Phkm assert(actual, {})5_  ifCf=v=Piko ikn5_   j fCf=v=Piko values: []5_   jfCf=v=Pjl error: Errorilo values: [1, 2]5_   kfCf=v=Pjlp error: Error()5_  kfCf=v=PJjlp error: Error("")5_ lfCf=v=P kmp })5_lfCf=v=P Kkmp }, "")5_f)fCf=v=P,egpF assert.ok(isReduced(send(e, 3)), "ended returns reduced on errored")5_fFfCf=v=P0egpH assert.ok(isReduced(send(e, 3)), "errored returns reduced on errored")5_g+fCf=v=P2fhpH assert.ok(isReduced(send(e, end)), "ended returns reduced on errored")5_gHfCf=v=P6LfhpJ assert.ok(isReduced(send(e, end)), "errored returns reduced on errored")5_iil.vP[hjp assert(actual, { values: [1, 2], error: Error("boom"). }, "only values before error are delivered")5_`ii0vP]agn `cm `bl5_`oo0vP`^`r var e = event()_ar var actual = into(e)5__nn0vPt_ar _aq5_`oo0vP_ar var actual = delay()5_`oo0vP_ar var actual = delay(.)5_oo0vPsr5_pp0vPsvar delay = require()5_pp0vPNsvar delay = require("")5_opp0vPno5_ ooo0vPOno 5_! !PxDq.var isReduced = require("reducers/is-reduced")5_ "!PxI q!var end = require("reducers/end")5_!#"!vPxP q"var end = require("reducible/end")5_"$#!vPxQ5_#%$!vPxRqp5_$&%! ! vPxSq5_%'& ! vPxTQr5_&('rvPyRqvar send = require("../send")var event = require("../event")/var isReduced = require("reducible/is-reduced")"var end = require("reducible/end")#var into = require("reducers/into")%var delay = require("reducers/delay")-var test = require("reducers/test/util/test")'var concat = require("reducers/concat")4exports["test event send"] = test(function(assert) { var e = event()B assert(e, ["hello", "world"], "two values are send to an event") send(e, "hello", "a", "b") send(e, "world") send(e, end)})?exports["test event miss some sends"] = test(function(assert) { var e = event() send(e, 1) send(e, 2)@ assert(e, [3, 4], "values send after reduction are collected") send(e, 3) send(e, 4) send(e, end)})9exports["test event early end"] = test(function(assert) { var e = event() send(e, "hello", "a", "b") send(e, "world") send(e, end) assert(e, { values: [],, error: Error("Event is already reduced")) }, "event ended bofore it was reduced")})>exports["test returns reduced after end"] = function(assert) { var e = event() send(e, 1) send(e, end)D assert.ok(isReduced(send(e, 2)), "ended returns reduced on value")D assert.ok(isReduced(send(e, end)), "ended returns reduced on end")}Bexports["test can be reduced only once"] = test(function(assert) { var e = event() var actual = into(e) var errored = into(e) send(e, 1) send(e, 2) send(e, end)? assert.deepEqual(into(e), [], "read after end returns empty")# assert(concat(actual, errored), { values: [1, 2],, error: Error("Event is already reduced")# }, "send vales were accumulated")});exports["test concat with event"] = test(function(assert) { var left = event() var right = event()/ var actual = concat(left, [ 4, 5, 6 ], right) send(left, 1) send(right, 7); assert(actual, [2, 3, 4, 5, 6, 9], "concatinates lazily") send(left, 2) send(right, 8) send(left, 3) send(left, end) send(right, 9) send(right, end)})0exports["test errors"] = test(function(assert) { var e = event() var actual = delay(e) assert(actual, { values: [1, 2], error: Error("boom"). }, "only values before error are delivered") send(e, 1) send(e, 2) send(e, Error("boom"))= assert.ok(isReduced(send(e, 3)), "errored returns reduced")? assert.ok(isReduced(send(e, end)), "errored returns reduced")})require("test").run(exports)5_')(vPy(exports5_(*)vPy* exports[]5_)+* vPy* exports[""]5_*,+vPy-exports["test event"]5_+-, vPy.!exports["test event"] = require()5_,.-!vPy/S#exports["test event"] = require("")5_-/.*vPy85_.0/*vPy:*exports["test event"] = require("./event")5_/10'*vPy=T)exports["test pipe"] = require("./event")5_021'vPyO5_132'vPyQ(exports["test pipe"] = require("./pipe")5_243('vPySU*exports["test buffer"] = require("./pipe")5_354+vPyW 5_465*+vPyX ,exports["test buffer"] = require("./buffer")5_576+vPy[V +exports["test buffer"] = require("./cache")5_687*vPyg  5_798*vPyi *exports["test cache"] = require("./cache")5_8:9&*vPykW (exports["test hub"] = require("./cache")5_9;:*vPys5_:;*vPysX5_ann0vPcM`bq assert(e, {5_@ ;=vP?AU send(e, 2) 5_i  vPNhjm9 "a#1", c#2", "d#1", "e#2", "f#2", "f#1", "g#2", "g#1"5_911vPĊ8:5_dfe(vP') () {5_PRVQ vPŽ 5_QSR vP 5_RTSvP 5_SUT vP‘ 5_TU vP—    watch5