From fc8ebf238e5d8c6d14710a4c27e2c2089f28fd40 Mon Sep 17 00:00:00 2001 From: actions Date: Mon, 15 Jan 2024 18:02:57 +0000 Subject: [PATCH] Adding deno distribution files and moving files from /dist to / --- .github/FUNDING.yml | 4 - .github/workflows/ci.yaml | 147 - .gitignore | 48 +- deno_dist/LICENSE | 21 + deno_dist/README.md | 121 + deno_dist/hooks/index.ts | 9 + deno_dist/hooks/useEvt.ts | 51 + deno_dist/hooks/useRerenderOnStateChange.ts | 27 + deno_dist/lib/Ctx.ts | 166 + deno_dist/lib/Evt.asNonPostable.ts | 7 + deno_dist/lib/Evt.asPostable.ts | 11 + deno_dist/lib/Evt.asyncPipe.ts | 77 + deno_dist/lib/Evt.create.ts | 22 + deno_dist/lib/Evt.factorize.ts | 14 + deno_dist/lib/Evt.from.ts | 335 + deno_dist/lib/Evt.getCtx.ts | 33 + deno_dist/lib/Evt.loosenType.ts | 20 + deno_dist/lib/Evt.merge.ts | 51 + deno_dist/lib/Evt.newCtx.ts | 11 + deno_dist/lib/Evt.parsePropsFromArgs.ts | 250 + deno_dist/lib/Evt.ts | 1060 + deno_dist/lib/LazyEvt.ts | 44 + deno_dist/lib/LazyStatefulEvt.ts | 54 + deno_dist/lib/StatefulEvt.ts | 172 + deno_dist/lib/importProxy.ts | 14 + deno_dist/lib/index.ts | 15 + deno_dist/lib/types/AsyncIterableEvt.ts | 5 + deno_dist/lib/types/EventTargetLike.ts | 141 + deno_dist/lib/types/EvtError.ts | 18 + deno_dist/lib/types/Handler.ts | 59 + deno_dist/lib/types/Observer.ts | 15 + deno_dist/lib/types/Operator.ts | 33 + deno_dist/lib/types/helper/EvtLikeToEvt.ts | 6 + deno_dist/lib/types/helper/FactorizeEvt.ts | 8 + deno_dist/lib/types/helper/SwapEvtType.ts | 14 + .../lib/types/helper/ToNonPostableEvt.ts | 19 + deno_dist/lib/types/helper/ToPostableEvt.ts | 24 + deno_dist/lib/types/helper/UnpackCtx.ts | 11 + deno_dist/lib/types/helper/UnpackEvt.ts | 18 + deno_dist/lib/types/helper/index.ts | 8 + deno_dist/lib/types/index.ts | 11 + deno_dist/lib/types/interfaces/Ctx.ts | 104 + deno_dist/lib/types/interfaces/CtxLike.ts | 30 + deno_dist/lib/types/interfaces/Evt.ts | 5 + deno_dist/lib/types/interfaces/EvtLike.ts | 6 + .../lib/types/interfaces/NonPostableEvt.ts | 1886 ++ .../types/interfaces/NonPostableEvtLike.ts | 7 + deno_dist/lib/types/interfaces/Postable.ts | 19 + deno_dist/lib/types/interfaces/StatefulEvt.ts | 10 + .../lib/types/interfaces/StatefulEvtLike.ts | 6 + .../lib/types/interfaces/StatefulPostable.ts | 11 + .../types/interfaces/StatefulReadonlyEvt.ts | 163 + .../interfaces/StatefulReadonlyEvtLike.ts | 6 + deno_dist/lib/types/interfaces/index.ts | 12 + deno_dist/lib/types/lib.dom.ts | 16199 ++++++++++++++++ deno_dist/lib/util/compose.ts | 165 + .../util/convertOperatorToStatelessFLambda.ts | 54 + deno_dist/lib/util/index.ts | 1 + deno_dist/mod.ts | 1 + deno_dist/operators/chunksOf.ts | 50 + deno_dist/operators/distinct.ts | 49 + deno_dist/operators/index.ts | 7 + deno_dist/operators/nonNullable.ts | 10 + deno_dist/operators/onlyIfChanged.ts | 30 + deno_dist/operators/scan.ts | 13 + deno_dist/operators/throttleTime.ts | 19 + deno_dist/operators/to.ts | 30 + deno_dist/test/getHandlerPr.ts | 24 + deno_dist/test/index.ts | 94 + deno_dist/test/mod.ts | 97 + deno_dist/test/test1.ts | 33 + deno_dist/test/test10.ts | 31 + deno_dist/test/test100.ts | 9 + deno_dist/test/test101.ts | 69 + deno_dist/test/test102.ts | 69 + deno_dist/test/test103.ts | 52 + deno_dist/test/test104.ts | 50 + deno_dist/test/test105.ts | 28 + deno_dist/test/test106.ts | 77 + deno_dist/test/test107.ts | 59 + deno_dist/test/test108.ts | 12 + deno_dist/test/test109.ts | 27 + deno_dist/test/test11.ts | 35 + deno_dist/test/test110.ts | 27 + deno_dist/test/test12.ts | 30 + deno_dist/test/test13.ts | 42 + deno_dist/test/test14.ts | 48 + deno_dist/test/test15.ts | 115 + deno_dist/test/test16.ts | 67 + deno_dist/test/test17.ts | 62 + deno_dist/test/test18.ts | 43 + deno_dist/test/test19.ts | 22 + deno_dist/test/test2.ts | 52 + deno_dist/test/test20.ts | 43 + deno_dist/test/test21.ts | 53 + deno_dist/test/test22.ts | 886 + deno_dist/test/test23.ts | 66 + deno_dist/test/test24.ts | 19 + deno_dist/test/test25.ts | 78 + deno_dist/test/test26.ts | 45 + deno_dist/test/test27.ts | 47 + deno_dist/test/test28.ts | 60 + deno_dist/test/test29.ts | 65 + deno_dist/test/test3.ts | 31 + deno_dist/test/test30.ts | 29 + deno_dist/test/test31.ts | 19 + deno_dist/test/test32.ts | 61 + deno_dist/test/test33.ts | 94 + deno_dist/test/test34.ts | 46 + deno_dist/test/test35.ts | 160 + deno_dist/test/test36.ts | 20 + deno_dist/test/test37.ts | 378 + deno_dist/test/test38.ts | 145 + deno_dist/test/test39.ts | 214 + deno_dist/test/test4.ts | 29 + deno_dist/test/test44.ts | 23 + deno_dist/test/test49.ts | 81 + deno_dist/test/test5.ts | 34 + deno_dist/test/test50.ts | 24 + deno_dist/test/test51.ts | 143 + deno_dist/test/test52.ts | 39 + deno_dist/test/test53.ts | 29 + deno_dist/test/test54.ts | 19 + deno_dist/test/test55.ts | 123 + deno_dist/test/test56.ts | 74 + deno_dist/test/test57.ts | 72 + deno_dist/test/test59.ts | 58 + deno_dist/test/test6.ts | 42 + deno_dist/test/test60.ts | 20 + deno_dist/test/test61.ts | 35 + deno_dist/test/test62.ts | 235 + deno_dist/test/test63.ts | 124 + deno_dist/test/test64.ts | 38 + deno_dist/test/test65.ts | 60 + deno_dist/test/test66.ts | 30 + deno_dist/test/test67.ts | 143 + deno_dist/test/test68.ts | 70 + deno_dist/test/test69.ts | 13 + deno_dist/test/test7.ts | 28 + deno_dist/test/test70.ts | 14 + deno_dist/test/test71.ts | 27 + deno_dist/test/test73.ts | 183 + deno_dist/test/test76.ts | 97 + deno_dist/test/test78.ts | 95 + deno_dist/test/test79.ts | 23 + deno_dist/test/test8.ts | 105 + deno_dist/test/test80.ts | 19 + deno_dist/test/test81.ts | 104 + deno_dist/test/test82.ts | 42 + deno_dist/test/test83.ts | 41 + deno_dist/test/test84.ts | 17 + deno_dist/test/test85.ts | 7 + deno_dist/test/test86.ts | 35 + deno_dist/test/test87.ts | 26 + deno_dist/test/test88.ts | 17 + deno_dist/test/test9.ts | 159 + deno_dist/test/test90.ts | 40 + deno_dist/test/test91.ts | 48 + deno_dist/test/test92.ts | 31 + deno_dist/test/test93.ts | 20 + deno_dist/test/test94.ts | 14 + deno_dist/test/test95.ts | 123 + deno_dist/test/test96.ts | 18 + deno_dist/test/test97.ts | 57 + deno_dist/test/test98.ts | 15 + deno_dist/test/test99.ts | 25 + deno_dist/test/types/Evt.create.ts | 121 + deno_dist/test/types/EvtLike.ts | 35 + deno_dist/test/types/EvtLikeToEvt.ts | 44 + deno_dist/test/types/README.md | 2 + deno_dist/test/types/UnpackEvt.ts | 67 + deno_dist/tools/Deferred.ts | 66 + deno_dist/tools/concatUint8Array.ts | 33 + deno_dist/tools/inDepth/copy.ts | 147 + deno_dist/tools/inDepth/getPrototypeChain.ts | 36 + deno_dist/tools/inDepth/index.ts | 3 + deno_dist/tools/inDepth/same.ts | 250 + deno_dist/tools/inDepth/test.ts | 433 + deno_dist/tools/inDepth/types.ts | 69 + deno_dist/tools/isCallableFunction.ts | 29 + deno_dist/tools/minimal-polyfills/LightMap.ts | 8 + deno_dist/tools/minimal-polyfills/LightSet.ts | 7 + .../useEffectRunConditionToDependencyArray.ts | 77 + deno_dist/tools/powerhooks/useEffectIf.ts | 46 + .../tools/powerhooks/useGuaranteedMemo.ts | 21 + deno_dist/tools/reducers/allEquals.ts | 26 + deno_dist/tools/reducers/allEqualsTo.ts | 23 + deno_dist/tools/reducers/allUniq.ts | 28 + deno_dist/tools/reducers/and.ts | 14 + deno_dist/tools/reducers/contains.ts | 28 + deno_dist/tools/reducers/count.ts | 20 + deno_dist/tools/reducers/diff.ts | 81 + deno_dist/tools/reducers/every.ts | 17 + deno_dist/tools/reducers/includes.ts | 10 + deno_dist/tools/reducers/index.ts | 28 + deno_dist/tools/reducers/or.ts | 16 + deno_dist/tools/reducers/partition.ts | 47 + deno_dist/tools/reducers/reduceify.ts | 38 + deno_dist/tools/reducers/removeDuplicates.ts | 30 + deno_dist/tools/reducers/sameAs.ts | 37 + deno_dist/tools/reducers/test.ts | 195 + deno_dist/tools/safeSetTimeout.ts | 5 + .../tools/testing/getPromiseAssertionApi.ts | 83 + deno_dist/tools/testing/index.ts | 1 + deno_dist/tools/tsafe/capitalize.ts | 4 + hooks/index.d.ts | 2 + hooks/index.js | 15 + hooks/index.js.map | 1 + hooks/useEvt.d.ts | 31 + hooks/useEvt.js | 66 + hooks/useEvt.js.map | 1 + hooks/useRerenderOnStateChange.d.ts | 12 + hooks/useRerenderOnStateChange.js | 60 + hooks/useRerenderOnStateChange.js.map | 1 + lib/Ctx.d.ts | 5 + lib/Ctx.js | 157 + lib/Ctx.js.map | 1 + lib/Evt.asNonPostable.d.ts | 3 + lib/Evt.asNonPostable.js | 9 + lib/Evt.asNonPostable.js.map | 1 + lib/Evt.asPostable.d.ts | 7 + lib/Evt.asPostable.js | 13 + lib/Evt.asPostable.js.map | 1 + lib/Evt.asyncPipe.d.ts | 17 + lib/Evt.asyncPipe.js | 93 + lib/Evt.asyncPipe.js.map | 1 + lib/Evt.create.d.ts | 13 + lib/Evt.create.js | 15 + lib/Evt.create.js.map | 1 + lib/Evt.d.ts | 39 + lib/Evt.factorize.d.ts | 3 + lib/Evt.factorize.js | 14 + lib/Evt.factorize.js.map | 1 + lib/Evt.from.d.ts | 28 + lib/Evt.from.js | 154 + lib/Evt.from.js.map | 1 + lib/Evt.getCtx.d.ts | 9 + lib/Evt.getCtx.js | 27 + lib/Evt.getCtx.js.map | 1 + lib/Evt.js | 872 + lib/Evt.js.map | 1 + lib/Evt.loosenType.d.ts | 5 + lib/Evt.loosenType.js | 16 + lib/Evt.loosenType.js.map | 1 + lib/Evt.merge.d.ts | 5 + lib/Evt.merge.js | 25 + lib/Evt.merge.js.map | 1 + lib/Evt.newCtx.d.ts | 7 + lib/Evt.newCtx.js | 14 + lib/Evt.newCtx.js.map | 1 + lib/Evt.parsePropsFromArgs.d.ts | 3 + lib/Evt.parsePropsFromArgs.js | 188 + lib/Evt.parsePropsFromArgs.js.map | 1 + lib/LazyEvt.d.ts | 9 + lib/LazyEvt.js | 36 + lib/LazyEvt.js.map | 1 + lib/LazyStatefulEvt.d.ts | 11 + lib/LazyStatefulEvt.js | 40 + lib/LazyStatefulEvt.js.map | 1 + lib/StatefulEvt.d.ts | 7 + lib/StatefulEvt.js | 167 + lib/StatefulEvt.js.map | 1 + lib/importProxy.d.ts | 9 + lib/importProxy.js | 6 + lib/importProxy.js.map | 1 + lib/index.d.ts | 9 + lib/index.js | 36 + lib/index.js.map | 1 + lib/types/AsyncIterableEvt.d.ts | 4 + lib/types/AsyncIterableEvt.js | 3 + lib/types/AsyncIterableEvt.js.map | 1 + lib/types/EventTargetLike.d.ts | 54 + lib/types/EventTargetLike.js | 61 + lib/types/EventTargetLike.js.map | 1 + lib/types/EvtError.d.ts | 7 + lib/types/EvtError.js | 42 + lib/types/EvtError.js.map | 1 + lib/types/Handler.d.ts | 46 + lib/types/Handler.js | 3 + lib/types/Handler.js.map | 1 + lib/types/Observer.d.ts | 9 + lib/types/Observer.js | 3 + lib/types/Observer.js.map | 1 + lib/types/Operator.d.ts | 14 + lib/types/Operator.js | 3 + lib/types/Operator.js.map | 1 + lib/types/helper/EvtLikeToEvt.d.ts | 4 + lib/types/helper/EvtLikeToEvt.js | 3 + lib/types/helper/EvtLikeToEvt.js.map | 1 + lib/types/helper/FactorizeEvt.d.ts | 5 + lib/types/helper/FactorizeEvt.js | 3 + lib/types/helper/FactorizeEvt.js.map | 1 + lib/types/helper/SwapEvtType.d.ts | 3 + lib/types/helper/SwapEvtType.js | 3 + lib/types/helper/SwapEvtType.js.map | 1 + lib/types/helper/ToNonPostableEvt.d.ts | 12 + lib/types/helper/ToNonPostableEvt.js | 3 + lib/types/helper/ToNonPostableEvt.js.map | 1 + lib/types/helper/ToPostableEvt.d.ts | 12 + lib/types/helper/ToPostableEvt.js | 3 + lib/types/helper/ToPostableEvt.js.map | 1 + lib/types/helper/UnpackCtx.d.ts | 5 + lib/types/helper/UnpackCtx.js | 3 + lib/types/helper/UnpackCtx.js.map | 1 + lib/types/helper/UnpackEvt.d.ts | 15 + lib/types/helper/UnpackEvt.js | 3 + lib/types/helper/UnpackEvt.js.map | 1 + lib/types/helper/index.d.ts | 7 + lib/types/helper/index.js | 3 + lib/types/helper/index.js.map | 1 + lib/types/index.d.ts | 7 + lib/types/index.js | 37 + lib/types/index.js.map | 1 + lib/types/interfaces/Ctx.d.ts | 80 + lib/types/interfaces/Ctx.js | 3 + lib/types/interfaces/Ctx.js.map | 1 + lib/types/interfaces/CtxLike.d.ts | 15 + lib/types/interfaces/CtxLike.js | 17 + lib/types/interfaces/CtxLike.js.map | 1 + lib/types/interfaces/Evt.d.ts | 4 + lib/types/interfaces/Evt.js | 3 + lib/types/interfaces/Evt.js.map | 1 + lib/types/interfaces/EvtLike.d.ts | 4 + lib/types/interfaces/EvtLike.js | 4 + lib/types/interfaces/EvtLike.js.map | 1 + lib/types/interfaces/NonPostableEvt.d.ts | 1266 ++ lib/types/interfaces/NonPostableEvt.js | 3 + lib/types/interfaces/NonPostableEvt.js.map | 1 + lib/types/interfaces/NonPostableEvtLike.d.ts | 5 + lib/types/interfaces/NonPostableEvtLike.js | 4 + .../interfaces/NonPostableEvtLike.js.map | 1 + lib/types/interfaces/Postable.d.ts | 14 + lib/types/interfaces/Postable.js | 3 + lib/types/interfaces/Postable.js.map | 1 + lib/types/interfaces/StatefulEvt.d.ts | 6 + lib/types/interfaces/StatefulEvt.js | 4 + lib/types/interfaces/StatefulEvt.js.map | 1 + lib/types/interfaces/StatefulEvtLike.d.ts | 4 + lib/types/interfaces/StatefulEvtLike.js | 4 + lib/types/interfaces/StatefulEvtLike.js.map | 1 + lib/types/interfaces/StatefulPostable.d.ts | 6 + lib/types/interfaces/StatefulPostable.js | 3 + lib/types/interfaces/StatefulPostable.js.map | 1 + lib/types/interfaces/StatefulReadonlyEvt.d.ts | 54 + lib/types/interfaces/StatefulReadonlyEvt.js | 3 + .../interfaces/StatefulReadonlyEvt.js.map | 1 + .../interfaces/StatefulReadonlyEvtLike.d.ts | 4 + .../interfaces/StatefulReadonlyEvtLike.js | 4 + .../interfaces/StatefulReadonlyEvtLike.js.map | 1 + lib/types/interfaces/index.d.ts | 12 + lib/types/interfaces/index.js | 18 + lib/types/interfaces/index.js.map | 1 + lib/types/lib.dom.d.ts | 14466 ++++++++++++++ lib/types/lib.dom.js | 30 + lib/types/lib.dom.js.map | 1 + lib/util/compose.d.ts | 22 + lib/util/compose.js | 64 + lib/util/compose.js.map | 1 + .../convertOperatorToStatelessFLambda.d.ts | 2 + lib/util/convertOperatorToStatelessFLambda.js | 39 + .../convertOperatorToStatelessFLambda.js.map | 1 + lib/util/index.d.ts | 1 + lib/util/index.js | 6 + lib/util/index.js.map | 1 + operators/chunksOf.d.ts | 2 + operators/chunksOf.js | 64 + operators/chunksOf.js.map | 1 + operators/distinct.d.ts | 7 + operators/distinct.js | 64 + operators/distinct.js.map | 1 + operators/index.d.ts | 7 + operators/index.js | 18 + operators/index.js.map | 1 + operators/nonNullable.d.ts | 1 + operators/nonNullable.js | 14 + operators/nonNullable.js.map | 1 + operators/onlyIfChanged.d.ts | 4 + operators/onlyIfChanged.js | 20 + operators/onlyIfChanged.js.map | 1 + operators/scan.d.ts | 1 + operators/scan.js | 32 + operators/scan.js.map | 1 + operators/throttleTime.d.ts | 1 + operators/throttleTime.js | 21 + operators/throttleTime.js.map | 1 + operators/to.d.ts | 7 + operators/to.js | 27 + operators/to.js.map | 1 + package.json | 514 +- test/getHandlerPr.d.ts | 4 + test/getHandlerPr.js | 16 + test/getHandlerPr.js.map | 1 + test/index.d.ts | 1 + test/index.js | 88 + test/index.js.map | 1 + test/mod.d.ts | 82 + test/mod.js | 85 + test/mod.js.map | 1 + test/test1.d.ts | 1 + test/test1.js | 24 + test/test1.js.map | 1 + test/test10.d.ts | 1 + test/test10.js | 22 + test/test10.js.map | 1 + test/test100.d.ts | 1 + test/test100.js | 8 + test/test100.js.map | 1 + test/test101.d.ts | 1 + test/test101.js | 122 + test/test101.js.map | 1 + test/test102.d.ts | 1 + test/test102.js | 122 + test/test102.js.map | 1 + test/test103.d.ts | 1 + test/test103.js | 106 + test/test103.js.map | 1 + test/test104.d.ts | 1 + test/test104.js | 106 + test/test104.js.map | 1 + test/test105.d.ts | 1 + test/test105.js | 17 + test/test105.js.map | 1 + test/test106.d.ts | 1 + test/test106.js | 141 + test/test106.js.map | 1 + test/test107.d.ts | 1 + test/test107.js | 129 + test/test107.js.map | 1 + test/test108.d.ts | 1 + test/test108.js | 11 + test/test108.js.map | 1 + test/test109.d.ts | 1 + test/test109.js | 22 + test/test109.js.map | 1 + test/test11.d.ts | 1 + test/test11.js | 24 + test/test11.js.map | 1 + test/test110.d.ts | 1 + test/test110.js | 22 + test/test110.js.map | 1 + test/test12.d.ts | 1 + test/test12.js | 64 + test/test12.js.map | 1 + test/test13.d.ts | 1 + test/test13.js | 76 + test/test13.js.map | 1 + test/test14.d.ts | 1 + test/test14.js | 74 + test/test14.js.map | 1 + test/test15.d.ts | 1 + test/test15.js | 182 + test/test15.js.map | 1 + test/test16.d.ts | 1 + test/test16.js | 53 + test/test16.js.map | 1 + test/test17.d.ts | 1 + test/test17.js | 54 + test/test17.js.map | 1 + test/test18.d.ts | 1 + test/test18.js | 22 + test/test18.js.map | 1 + test/test19.d.ts | 1 + test/test19.js | 15 + test/test19.js.map | 1 + test/test2.d.ts | 1 + test/test2.js | 68 + test/test2.js.map | 1 + test/test20.d.ts | 1 + test/test20.js | 74 + test/test20.js.map | 1 + test/test21.d.ts | 1 + test/test21.js | 123 + test/test21.js.map | 1 + test/test22.d.ts | 1 + test/test22.js | 502 + test/test22.js.map | 1 + test/test23.d.ts | 1 + test/test23.js | 30 + test/test23.js.map | 1 + test/test24.d.ts | 1 + test/test24.js | 13 + test/test24.js.map | 1 + test/test25.d.ts | 1 + test/test25.js | 108 + test/test25.js.map | 1 + test/test26.d.ts | 1 + test/test26.js | 24 + test/test26.js.map | 1 + test/test27.d.ts | 1 + test/test27.js | 67 + test/test27.js.map | 1 + test/test28.d.ts | 1 + test/test28.js | 75 + test/test28.js.map | 1 + test/test29.d.ts | 1 + test/test29.js | 79 + test/test29.js.map | 1 + test/test3.d.ts | 1 + test/test3.js | 17 + test/test3.js.map | 1 + test/test30.d.ts | 1 + test/test30.js | 16 + test/test30.js.map | 1 + test/test31.d.ts | 1 + test/test31.js | 59 + test/test31.js.map | 1 + test/test32.d.ts | 5 + test/test32.js | 114 + test/test32.js.map | 1 + test/test33.d.ts | 1 + test/test33.js | 46 + test/test33.js.map | 1 + test/test34.d.ts | 1 + test/test34.js | 27 + test/test34.js.map | 1 + test/test35.d.ts | 1 + test/test35.js | 128 + test/test35.js.map | 1 + test/test36.d.ts | 1 + test/test36.js | 11 + test/test36.js.map | 1 + test/test37.d.ts | 9 + test/test37.js | 284 + test/test37.js.map | 1 + test/test38.d.ts | 9 + test/test38.js | 78 + test/test38.js.map | 1 + test/test39.d.ts | 1 + test/test39.js | 193 + test/test39.js.map | 1 + test/test4.d.ts | 1 + test/test4.js | 16 + test/test4.js.map | 1 + test/test44.d.ts | 1 + test/test44.js | 14 + test/test44.js.map | 1 + test/test49.d.ts | 1 + test/test49.js | 79 + test/test49.js.map | 1 + test/test5.d.ts | 1 + test/test5.js | 68 + test/test5.js.map | 1 + test/test50.d.ts | 1 + test/test50.js | 36 + test/test50.js.map | 1 + test/test51.d.ts | 1 + test/test51.js | 150 + test/test51.js.map | 1 + test/test52.d.ts | 1 + test/test52.js | 74 + test/test52.js.map | 1 + test/test53.d.ts | 1 + test/test53.js | 22 + test/test53.js.map | 1 + test/test54.d.ts | 1 + test/test54.js | 15 + test/test54.js.map | 1 + test/test55.d.ts | 1 + test/test55.js | 124 + test/test55.js.map | 1 + test/test56.d.ts | 1 + test/test56.js | 143 + test/test56.js.map | 1 + test/test57.d.ts | 1 + test/test57.js | 142 + test/test57.js.map | 1 + test/test59.d.ts | 1 + test/test59.js | 31 + test/test59.js.map | 1 + test/test6.d.ts | 1 + test/test6.js | 79 + test/test6.js.map | 1 + test/test60.d.ts | 1 + test/test60.js | 37 + test/test60.js.map | 1 + test/test61.d.ts | 1 + test/test61.js | 22 + test/test61.js.map | 1 + test/test62.d.ts | 1 + test/test62.js | 289 + test/test62.js.map | 1 + test/test63.d.ts | 1 + test/test63.js | 84 + test/test63.js.map | 1 + test/test64.d.ts | 1 + test/test64.js | 24 + test/test64.js.map | 1 + test/test65.d.ts | 1 + test/test65.js | 38 + test/test65.js.map | 1 + test/test66.d.ts | 1 + test/test66.js | 16 + test/test66.js.map | 1 + test/test67.d.ts | 1 + test/test67.js | 59 + test/test67.js.map | 1 + test/test68.d.ts | 1 + test/test68.js | 25 + test/test68.js.map | 1 + test/test69.d.ts | 1 + test/test69.js | 11 + test/test69.js.map | 1 + test/test7.d.ts | 1 + test/test7.js | 60 + test/test7.js.map | 1 + test/test70.d.ts | 1 + test/test70.js | 12 + test/test70.js.map | 1 + test/test71.d.ts | 1 + test/test71.js | 17 + test/test71.js.map | 1 + test/test73.d.ts | 1 + test/test73.js | 103 + test/test73.js.map | 1 + test/test76.d.ts | 1 + test/test76.js | 104 + test/test76.js.map | 1 + test/test78.d.ts | 1 + test/test78.js | 101 + test/test78.js.map | 1 + test/test79.d.ts | 1 + test/test79.js | 19 + test/test79.js.map | 1 + test/test8.d.ts | 13 + test/test8.js | 73 + test/test8.js.map | 1 + test/test80.d.ts | 1 + test/test80.js | 38 + test/test80.js.map | 1 + test/test81.d.ts | 1 + test/test81.js | 66 + test/test81.js.map | 1 + test/test82.d.ts | 1 + test/test82.js | 54 + test/test82.js.map | 1 + test/test83.d.ts | 1 + test/test83.js | 19 + test/test83.js.map | 1 + test/test84.d.ts | 1 + test/test84.js | 38 + test/test84.js.map | 1 + test/test85.d.ts | 1 + test/test85.js | 8 + test/test85.js.map | 1 + test/test86.d.ts | 1 + test/test86.js | 28 + test/test86.js.map | 1 + test/test87.d.ts | 1 + test/test87.js | 19 + test/test87.js.map | 1 + test/test88.d.ts | 1 + test/test88.js | 11 + test/test88.js.map | 1 + test/test9.d.ts | 13 + test/test9.js | 200 + test/test9.js.map | 1 + test/test90.d.ts | 1 + test/test90.js | 24 + test/test90.js.map | 1 + test/test91.d.ts | 1 + test/test91.js | 92 + test/test91.js.map | 1 + test/test92.d.ts | 1 + test/test92.js | 70 + test/test92.js.map | 1 + test/test93.d.ts | 1 + test/test93.js | 17 + test/test93.js.map | 1 + test/test94.d.ts | 1 + test/test94.js | 11 + test/test94.js.map | 1 + test/test95.d.ts | 1 + test/test95.js | 144 + test/test95.js.map | 1 + test/test96.d.ts | 1 + test/test96.js | 59 + test/test96.js.map | 1 + test/test97.d.ts | 1 + test/test97.js | 103 + test/test97.js.map | 1 + test/test98.d.ts | 1 + test/test98.js | 12 + test/test98.js.map | 1 + test/test99.d.ts | 1 + test/test99.js | 19 + test/test99.js.map | 1 + test/types/Evt.create.d.ts | 1 + test/types/Evt.create.js | 50 + test/types/Evt.create.js.map | 1 + test/types/EvtLike.d.ts | 1 + test/types/EvtLike.js | 18 + test/types/EvtLike.js.map | 1 + test/types/EvtLikeToEvt.d.ts | 1 + test/types/EvtLikeToEvt.js | 16 + test/types/EvtLikeToEvt.js.map | 1 + test/types/UnpackEvt.d.ts | 1 + test/types/UnpackEvt.js | 19 + test/types/UnpackEvt.js.map | 1 + tools/Deferred.d.ts | 14 + tools/Deferred.js | 50 + tools/Deferred.js.map | 1 + tools/concatUint8Array.d.ts | 1 + tools/concatUint8Array.js | 21 + tools/concatUint8Array.js.map | 1 + tools/inDepth/copy.d.ts | 14 + tools/inDepth/copy.js | 120 + tools/inDepth/copy.js.map | 1 + tools/inDepth/getPrototypeChain.d.ts | 4 + tools/inDepth/getPrototypeChain.js | 50 + tools/inDepth/getPrototypeChain.js.map | 1 + tools/inDepth/index.d.ts | 2 + tools/inDepth/index.js | 19 + tools/inDepth/index.js.map | 1 + tools/inDepth/same.d.ts | 30 + tools/inDepth/same.js | 216 + tools/inDepth/same.js.map | 1 + tools/inDepth/test.d.ts | 1 + tools/inDepth/test.js | 264 + tools/inDepth/test.js.map | 1 + tools/inDepth/types.d.ts | 23 + tools/inDepth/types.js | 45 + tools/inDepth/types.js.map | 1 + tools/isCallableFunction.d.ts | 6 + tools/isCallableFunction.js | 27 + tools/isCallableFunction.js.map | 1 + tools/minimal-polyfills/LightMap.d.ts | 8 + tools/minimal-polyfills/LightMap.js | 3 + tools/minimal-polyfills/LightMap.js.map | 1 + tools/minimal-polyfills/LightSet.d.ts | 7 + tools/minimal-polyfills/LightSet.js | 3 + tools/minimal-polyfills/LightSet.js.map | 1 + ...seEffectRunConditionToDependencyArray.d.ts | 26 + .../useEffectRunConditionToDependencyArray.js | 97 + ...EffectRunConditionToDependencyArray.js.map | 1 + tools/powerhooks/useEffectIf.d.ts | 4 + tools/powerhooks/useEffectIf.js | 58 + tools/powerhooks/useEffectIf.js.map | 1 + tools/powerhooks/useGuaranteedMemo.d.ts | 1 + tools/powerhooks/useGuaranteedMemo.js | 67 + tools/powerhooks/useGuaranteedMemo.js.map | 1 + tools/reducers/allEquals.d.ts | 8 + tools/reducers/allEquals.js | 49 + tools/reducers/allEquals.js.map | 1 + tools/reducers/allEqualsTo.d.ts | 8 + tools/reducers/allEqualsTo.js | 46 + tools/reducers/allEqualsTo.js.map | 1 + tools/reducers/allUniq.d.ts | 8 + tools/reducers/allUniq.js | 52 + tools/reducers/allUniq.js.map | 1 + tools/reducers/and.d.ts | 3 + tools/reducers/and.js | 13 + tools/reducers/and.js.map | 1 + tools/reducers/contains.d.ts | 3 + tools/reducers/contains.js | 41 + tools/reducers/contains.js.map | 1 + tools/reducers/count.d.ts | 3 + tools/reducers/count.js | 15 + tools/reducers/count.js.map | 1 + tools/reducers/diff.d.ts | 13 + tools/reducers/diff.js | 79 + tools/reducers/diff.js.map | 1 + tools/reducers/every.d.ts | 3 + tools/reducers/every.js | 16 + tools/reducers/every.js.map | 1 + tools/reducers/includes.d.ts | 3 + tools/reducers/includes.js | 13 + tools/reducers/includes.js.map | 1 + tools/reducers/index.d.ts | 13 + tools/reducers/index.js | 33 + tools/reducers/index.js.map | 1 + tools/reducers/or.d.ts | 3 + tools/reducers/or.js | 13 + tools/reducers/or.js.map | 1 + tools/reducers/partition.d.ts | 5 + tools/reducers/partition.js | 28 + tools/reducers/partition.js.map | 1 + tools/reducers/reduceify.d.ts | 3 + tools/reducers/reduceify.js | 57 + tools/reducers/reduceify.js.map | 1 + tools/reducers/removeDuplicates.d.ts | 8 + tools/reducers/removeDuplicates.js | 51 + tools/reducers/removeDuplicates.js.map | 1 + tools/reducers/sameAs.d.ts | 8 + tools/reducers/sameAs.js | 59 + tools/reducers/sameAs.js.map | 1 + tools/reducers/test.d.ts | 1 + tools/reducers/test.js | 124 + tools/reducers/test.js.map | 1 + tools/safeSetTimeout.d.ts | 5 + tools/safeSetTimeout.js | 8 + tools/safeSetTimeout.js.map | 1 + tools/testing/getPromiseAssertionApi.d.ts | 15 + tools/testing/getPromiseAssertionApi.js | 36 + tools/testing/getPromiseAssertionApi.js.map | 1 + tools/testing/index.d.ts | 1 + tools/testing/index.js | 18 + tools/testing/index.js.map | 1 + tools/tsafe/capitalize.d.ts | 2 + tools/tsafe/capitalize.js | 9 + tools/tsafe/capitalize.js.map | 1 + tsconfig.tsbuildinfo | 1 + 801 files changed, 59957 insertions(+), 224 deletions(-) delete mode 100644 .github/FUNDING.yml delete mode 100644 .github/workflows/ci.yaml create mode 100644 deno_dist/LICENSE create mode 100644 deno_dist/README.md create mode 100644 deno_dist/hooks/index.ts create mode 100644 deno_dist/hooks/useEvt.ts create mode 100644 deno_dist/hooks/useRerenderOnStateChange.ts create mode 100644 deno_dist/lib/Ctx.ts create mode 100644 deno_dist/lib/Evt.asNonPostable.ts create mode 100644 deno_dist/lib/Evt.asPostable.ts create mode 100644 deno_dist/lib/Evt.asyncPipe.ts create mode 100644 deno_dist/lib/Evt.create.ts create mode 100644 deno_dist/lib/Evt.factorize.ts create mode 100644 deno_dist/lib/Evt.from.ts create mode 100644 deno_dist/lib/Evt.getCtx.ts create mode 100644 deno_dist/lib/Evt.loosenType.ts create mode 100644 deno_dist/lib/Evt.merge.ts create mode 100644 deno_dist/lib/Evt.newCtx.ts create mode 100644 deno_dist/lib/Evt.parsePropsFromArgs.ts create mode 100644 deno_dist/lib/Evt.ts create mode 100644 deno_dist/lib/LazyEvt.ts create mode 100644 deno_dist/lib/LazyStatefulEvt.ts create mode 100644 deno_dist/lib/StatefulEvt.ts create mode 100644 deno_dist/lib/importProxy.ts create mode 100644 deno_dist/lib/index.ts create mode 100644 deno_dist/lib/types/AsyncIterableEvt.ts create mode 100644 deno_dist/lib/types/EventTargetLike.ts create mode 100644 deno_dist/lib/types/EvtError.ts create mode 100644 deno_dist/lib/types/Handler.ts create mode 100644 deno_dist/lib/types/Observer.ts create mode 100644 deno_dist/lib/types/Operator.ts create mode 100644 deno_dist/lib/types/helper/EvtLikeToEvt.ts create mode 100644 deno_dist/lib/types/helper/FactorizeEvt.ts create mode 100644 deno_dist/lib/types/helper/SwapEvtType.ts create mode 100644 deno_dist/lib/types/helper/ToNonPostableEvt.ts create mode 100644 deno_dist/lib/types/helper/ToPostableEvt.ts create mode 100644 deno_dist/lib/types/helper/UnpackCtx.ts create mode 100644 deno_dist/lib/types/helper/UnpackEvt.ts create mode 100644 deno_dist/lib/types/helper/index.ts create mode 100644 deno_dist/lib/types/index.ts create mode 100644 deno_dist/lib/types/interfaces/Ctx.ts create mode 100644 deno_dist/lib/types/interfaces/CtxLike.ts create mode 100644 deno_dist/lib/types/interfaces/Evt.ts create mode 100644 deno_dist/lib/types/interfaces/EvtLike.ts create mode 100644 deno_dist/lib/types/interfaces/NonPostableEvt.ts create mode 100644 deno_dist/lib/types/interfaces/NonPostableEvtLike.ts create mode 100644 deno_dist/lib/types/interfaces/Postable.ts create mode 100644 deno_dist/lib/types/interfaces/StatefulEvt.ts create mode 100644 deno_dist/lib/types/interfaces/StatefulEvtLike.ts create mode 100644 deno_dist/lib/types/interfaces/StatefulPostable.ts create mode 100644 deno_dist/lib/types/interfaces/StatefulReadonlyEvt.ts create mode 100644 deno_dist/lib/types/interfaces/StatefulReadonlyEvtLike.ts create mode 100644 deno_dist/lib/types/interfaces/index.ts create mode 100644 deno_dist/lib/types/lib.dom.ts create mode 100644 deno_dist/lib/util/compose.ts create mode 100644 deno_dist/lib/util/convertOperatorToStatelessFLambda.ts create mode 100644 deno_dist/lib/util/index.ts create mode 100644 deno_dist/mod.ts create mode 100644 deno_dist/operators/chunksOf.ts create mode 100644 deno_dist/operators/distinct.ts create mode 100644 deno_dist/operators/index.ts create mode 100644 deno_dist/operators/nonNullable.ts create mode 100644 deno_dist/operators/onlyIfChanged.ts create mode 100644 deno_dist/operators/scan.ts create mode 100644 deno_dist/operators/throttleTime.ts create mode 100644 deno_dist/operators/to.ts create mode 100644 deno_dist/test/getHandlerPr.ts create mode 100644 deno_dist/test/index.ts create mode 100644 deno_dist/test/mod.ts create mode 100644 deno_dist/test/test1.ts create mode 100644 deno_dist/test/test10.ts create mode 100644 deno_dist/test/test100.ts create mode 100644 deno_dist/test/test101.ts create mode 100644 deno_dist/test/test102.ts create mode 100644 deno_dist/test/test103.ts create mode 100644 deno_dist/test/test104.ts create mode 100644 deno_dist/test/test105.ts create mode 100644 deno_dist/test/test106.ts create mode 100644 deno_dist/test/test107.ts create mode 100644 deno_dist/test/test108.ts create mode 100644 deno_dist/test/test109.ts create mode 100644 deno_dist/test/test11.ts create mode 100644 deno_dist/test/test110.ts create mode 100644 deno_dist/test/test12.ts create mode 100644 deno_dist/test/test13.ts create mode 100644 deno_dist/test/test14.ts create mode 100644 deno_dist/test/test15.ts create mode 100644 deno_dist/test/test16.ts create mode 100644 deno_dist/test/test17.ts create mode 100644 deno_dist/test/test18.ts create mode 100644 deno_dist/test/test19.ts create mode 100644 deno_dist/test/test2.ts create mode 100644 deno_dist/test/test20.ts create mode 100644 deno_dist/test/test21.ts create mode 100644 deno_dist/test/test22.ts create mode 100644 deno_dist/test/test23.ts create mode 100644 deno_dist/test/test24.ts create mode 100644 deno_dist/test/test25.ts create mode 100644 deno_dist/test/test26.ts create mode 100644 deno_dist/test/test27.ts create mode 100644 deno_dist/test/test28.ts create mode 100644 deno_dist/test/test29.ts create mode 100644 deno_dist/test/test3.ts create mode 100644 deno_dist/test/test30.ts create mode 100644 deno_dist/test/test31.ts create mode 100644 deno_dist/test/test32.ts create mode 100644 deno_dist/test/test33.ts create mode 100644 deno_dist/test/test34.ts create mode 100644 deno_dist/test/test35.ts create mode 100644 deno_dist/test/test36.ts create mode 100644 deno_dist/test/test37.ts create mode 100644 deno_dist/test/test38.ts create mode 100644 deno_dist/test/test39.ts create mode 100644 deno_dist/test/test4.ts create mode 100644 deno_dist/test/test44.ts create mode 100644 deno_dist/test/test49.ts create mode 100644 deno_dist/test/test5.ts create mode 100644 deno_dist/test/test50.ts create mode 100644 deno_dist/test/test51.ts create mode 100644 deno_dist/test/test52.ts create mode 100644 deno_dist/test/test53.ts create mode 100644 deno_dist/test/test54.ts create mode 100644 deno_dist/test/test55.ts create mode 100644 deno_dist/test/test56.ts create mode 100644 deno_dist/test/test57.ts create mode 100644 deno_dist/test/test59.ts create mode 100644 deno_dist/test/test6.ts create mode 100644 deno_dist/test/test60.ts create mode 100644 deno_dist/test/test61.ts create mode 100644 deno_dist/test/test62.ts create mode 100644 deno_dist/test/test63.ts create mode 100644 deno_dist/test/test64.ts create mode 100644 deno_dist/test/test65.ts create mode 100644 deno_dist/test/test66.ts create mode 100644 deno_dist/test/test67.ts create mode 100644 deno_dist/test/test68.ts create mode 100644 deno_dist/test/test69.ts create mode 100644 deno_dist/test/test7.ts create mode 100644 deno_dist/test/test70.ts create mode 100644 deno_dist/test/test71.ts create mode 100644 deno_dist/test/test73.ts create mode 100644 deno_dist/test/test76.ts create mode 100644 deno_dist/test/test78.ts create mode 100644 deno_dist/test/test79.ts create mode 100644 deno_dist/test/test8.ts create mode 100644 deno_dist/test/test80.ts create mode 100644 deno_dist/test/test81.ts create mode 100644 deno_dist/test/test82.ts create mode 100644 deno_dist/test/test83.ts create mode 100644 deno_dist/test/test84.ts create mode 100644 deno_dist/test/test85.ts create mode 100644 deno_dist/test/test86.ts create mode 100644 deno_dist/test/test87.ts create mode 100644 deno_dist/test/test88.ts create mode 100644 deno_dist/test/test9.ts create mode 100644 deno_dist/test/test90.ts create mode 100644 deno_dist/test/test91.ts create mode 100644 deno_dist/test/test92.ts create mode 100644 deno_dist/test/test93.ts create mode 100644 deno_dist/test/test94.ts create mode 100644 deno_dist/test/test95.ts create mode 100644 deno_dist/test/test96.ts create mode 100644 deno_dist/test/test97.ts create mode 100644 deno_dist/test/test98.ts create mode 100644 deno_dist/test/test99.ts create mode 100644 deno_dist/test/types/Evt.create.ts create mode 100644 deno_dist/test/types/EvtLike.ts create mode 100644 deno_dist/test/types/EvtLikeToEvt.ts create mode 100644 deno_dist/test/types/README.md create mode 100644 deno_dist/test/types/UnpackEvt.ts create mode 100644 deno_dist/tools/Deferred.ts create mode 100644 deno_dist/tools/concatUint8Array.ts create mode 100644 deno_dist/tools/inDepth/copy.ts create mode 100644 deno_dist/tools/inDepth/getPrototypeChain.ts create mode 100644 deno_dist/tools/inDepth/index.ts create mode 100644 deno_dist/tools/inDepth/same.ts create mode 100644 deno_dist/tools/inDepth/test.ts create mode 100644 deno_dist/tools/inDepth/types.ts create mode 100644 deno_dist/tools/isCallableFunction.ts create mode 100644 deno_dist/tools/minimal-polyfills/LightMap.ts create mode 100644 deno_dist/tools/minimal-polyfills/LightSet.ts create mode 100644 deno_dist/tools/powerhooks/tools/useEffectRunConditionToDependencyArray.ts create mode 100644 deno_dist/tools/powerhooks/useEffectIf.ts create mode 100644 deno_dist/tools/powerhooks/useGuaranteedMemo.ts create mode 100644 deno_dist/tools/reducers/allEquals.ts create mode 100644 deno_dist/tools/reducers/allEqualsTo.ts create mode 100644 deno_dist/tools/reducers/allUniq.ts create mode 100644 deno_dist/tools/reducers/and.ts create mode 100644 deno_dist/tools/reducers/contains.ts create mode 100644 deno_dist/tools/reducers/count.ts create mode 100644 deno_dist/tools/reducers/diff.ts create mode 100644 deno_dist/tools/reducers/every.ts create mode 100644 deno_dist/tools/reducers/includes.ts create mode 100644 deno_dist/tools/reducers/index.ts create mode 100644 deno_dist/tools/reducers/or.ts create mode 100644 deno_dist/tools/reducers/partition.ts create mode 100644 deno_dist/tools/reducers/reduceify.ts create mode 100644 deno_dist/tools/reducers/removeDuplicates.ts create mode 100644 deno_dist/tools/reducers/sameAs.ts create mode 100644 deno_dist/tools/reducers/test.ts create mode 100644 deno_dist/tools/safeSetTimeout.ts create mode 100644 deno_dist/tools/testing/getPromiseAssertionApi.ts create mode 100644 deno_dist/tools/testing/index.ts create mode 100644 deno_dist/tools/tsafe/capitalize.ts create mode 100644 hooks/index.d.ts create mode 100644 hooks/index.js create mode 100644 hooks/index.js.map create mode 100644 hooks/useEvt.d.ts create mode 100644 hooks/useEvt.js create mode 100644 hooks/useEvt.js.map create mode 100644 hooks/useRerenderOnStateChange.d.ts create mode 100644 hooks/useRerenderOnStateChange.js create mode 100644 hooks/useRerenderOnStateChange.js.map create mode 100644 lib/Ctx.d.ts create mode 100644 lib/Ctx.js create mode 100644 lib/Ctx.js.map create mode 100644 lib/Evt.asNonPostable.d.ts create mode 100644 lib/Evt.asNonPostable.js create mode 100644 lib/Evt.asNonPostable.js.map create mode 100644 lib/Evt.asPostable.d.ts create mode 100644 lib/Evt.asPostable.js create mode 100644 lib/Evt.asPostable.js.map create mode 100644 lib/Evt.asyncPipe.d.ts create mode 100644 lib/Evt.asyncPipe.js create mode 100644 lib/Evt.asyncPipe.js.map create mode 100644 lib/Evt.create.d.ts create mode 100644 lib/Evt.create.js create mode 100644 lib/Evt.create.js.map create mode 100644 lib/Evt.d.ts create mode 100644 lib/Evt.factorize.d.ts create mode 100644 lib/Evt.factorize.js create mode 100644 lib/Evt.factorize.js.map create mode 100644 lib/Evt.from.d.ts create mode 100644 lib/Evt.from.js create mode 100644 lib/Evt.from.js.map create mode 100644 lib/Evt.getCtx.d.ts create mode 100644 lib/Evt.getCtx.js create mode 100644 lib/Evt.getCtx.js.map create mode 100644 lib/Evt.js create mode 100644 lib/Evt.js.map create mode 100644 lib/Evt.loosenType.d.ts create mode 100644 lib/Evt.loosenType.js create mode 100644 lib/Evt.loosenType.js.map create mode 100644 lib/Evt.merge.d.ts create mode 100644 lib/Evt.merge.js create mode 100644 lib/Evt.merge.js.map create mode 100644 lib/Evt.newCtx.d.ts create mode 100644 lib/Evt.newCtx.js create mode 100644 lib/Evt.newCtx.js.map create mode 100644 lib/Evt.parsePropsFromArgs.d.ts create mode 100644 lib/Evt.parsePropsFromArgs.js create mode 100644 lib/Evt.parsePropsFromArgs.js.map create mode 100644 lib/LazyEvt.d.ts create mode 100644 lib/LazyEvt.js create mode 100644 lib/LazyEvt.js.map create mode 100644 lib/LazyStatefulEvt.d.ts create mode 100644 lib/LazyStatefulEvt.js create mode 100644 lib/LazyStatefulEvt.js.map create mode 100644 lib/StatefulEvt.d.ts create mode 100644 lib/StatefulEvt.js create mode 100644 lib/StatefulEvt.js.map create mode 100644 lib/importProxy.d.ts create mode 100644 lib/importProxy.js create mode 100644 lib/importProxy.js.map create mode 100644 lib/index.d.ts create mode 100644 lib/index.js create mode 100644 lib/index.js.map create mode 100644 lib/types/AsyncIterableEvt.d.ts create mode 100644 lib/types/AsyncIterableEvt.js create mode 100644 lib/types/AsyncIterableEvt.js.map create mode 100644 lib/types/EventTargetLike.d.ts create mode 100644 lib/types/EventTargetLike.js create mode 100644 lib/types/EventTargetLike.js.map create mode 100644 lib/types/EvtError.d.ts create mode 100644 lib/types/EvtError.js create mode 100644 lib/types/EvtError.js.map create mode 100644 lib/types/Handler.d.ts create mode 100644 lib/types/Handler.js create mode 100644 lib/types/Handler.js.map create mode 100644 lib/types/Observer.d.ts create mode 100644 lib/types/Observer.js create mode 100644 lib/types/Observer.js.map create mode 100644 lib/types/Operator.d.ts create mode 100644 lib/types/Operator.js create mode 100644 lib/types/Operator.js.map create mode 100644 lib/types/helper/EvtLikeToEvt.d.ts create mode 100644 lib/types/helper/EvtLikeToEvt.js create mode 100644 lib/types/helper/EvtLikeToEvt.js.map create mode 100644 lib/types/helper/FactorizeEvt.d.ts create mode 100644 lib/types/helper/FactorizeEvt.js create mode 100644 lib/types/helper/FactorizeEvt.js.map create mode 100644 lib/types/helper/SwapEvtType.d.ts create mode 100644 lib/types/helper/SwapEvtType.js create mode 100644 lib/types/helper/SwapEvtType.js.map create mode 100644 lib/types/helper/ToNonPostableEvt.d.ts create mode 100644 lib/types/helper/ToNonPostableEvt.js create mode 100644 lib/types/helper/ToNonPostableEvt.js.map create mode 100644 lib/types/helper/ToPostableEvt.d.ts create mode 100644 lib/types/helper/ToPostableEvt.js create mode 100644 lib/types/helper/ToPostableEvt.js.map create mode 100644 lib/types/helper/UnpackCtx.d.ts create mode 100644 lib/types/helper/UnpackCtx.js create mode 100644 lib/types/helper/UnpackCtx.js.map create mode 100644 lib/types/helper/UnpackEvt.d.ts create mode 100644 lib/types/helper/UnpackEvt.js create mode 100644 lib/types/helper/UnpackEvt.js.map create mode 100644 lib/types/helper/index.d.ts create mode 100644 lib/types/helper/index.js create mode 100644 lib/types/helper/index.js.map create mode 100644 lib/types/index.d.ts create mode 100644 lib/types/index.js create mode 100644 lib/types/index.js.map create mode 100644 lib/types/interfaces/Ctx.d.ts create mode 100644 lib/types/interfaces/Ctx.js create mode 100644 lib/types/interfaces/Ctx.js.map create mode 100644 lib/types/interfaces/CtxLike.d.ts create mode 100644 lib/types/interfaces/CtxLike.js create mode 100644 lib/types/interfaces/CtxLike.js.map create mode 100644 lib/types/interfaces/Evt.d.ts create mode 100644 lib/types/interfaces/Evt.js create mode 100644 lib/types/interfaces/Evt.js.map create mode 100644 lib/types/interfaces/EvtLike.d.ts create mode 100644 lib/types/interfaces/EvtLike.js create mode 100644 lib/types/interfaces/EvtLike.js.map create mode 100644 lib/types/interfaces/NonPostableEvt.d.ts create mode 100644 lib/types/interfaces/NonPostableEvt.js create mode 100644 lib/types/interfaces/NonPostableEvt.js.map create mode 100644 lib/types/interfaces/NonPostableEvtLike.d.ts create mode 100644 lib/types/interfaces/NonPostableEvtLike.js create mode 100644 lib/types/interfaces/NonPostableEvtLike.js.map create mode 100644 lib/types/interfaces/Postable.d.ts create mode 100644 lib/types/interfaces/Postable.js create mode 100644 lib/types/interfaces/Postable.js.map create mode 100644 lib/types/interfaces/StatefulEvt.d.ts create mode 100644 lib/types/interfaces/StatefulEvt.js create mode 100644 lib/types/interfaces/StatefulEvt.js.map create mode 100644 lib/types/interfaces/StatefulEvtLike.d.ts create mode 100644 lib/types/interfaces/StatefulEvtLike.js create mode 100644 lib/types/interfaces/StatefulEvtLike.js.map create mode 100644 lib/types/interfaces/StatefulPostable.d.ts create mode 100644 lib/types/interfaces/StatefulPostable.js create mode 100644 lib/types/interfaces/StatefulPostable.js.map create mode 100644 lib/types/interfaces/StatefulReadonlyEvt.d.ts create mode 100644 lib/types/interfaces/StatefulReadonlyEvt.js create mode 100644 lib/types/interfaces/StatefulReadonlyEvt.js.map create mode 100644 lib/types/interfaces/StatefulReadonlyEvtLike.d.ts create mode 100644 lib/types/interfaces/StatefulReadonlyEvtLike.js create mode 100644 lib/types/interfaces/StatefulReadonlyEvtLike.js.map create mode 100644 lib/types/interfaces/index.d.ts create mode 100644 lib/types/interfaces/index.js create mode 100644 lib/types/interfaces/index.js.map create mode 100644 lib/types/lib.dom.d.ts create mode 100644 lib/types/lib.dom.js create mode 100644 lib/types/lib.dom.js.map create mode 100644 lib/util/compose.d.ts create mode 100644 lib/util/compose.js create mode 100644 lib/util/compose.js.map create mode 100644 lib/util/convertOperatorToStatelessFLambda.d.ts create mode 100644 lib/util/convertOperatorToStatelessFLambda.js create mode 100644 lib/util/convertOperatorToStatelessFLambda.js.map create mode 100644 lib/util/index.d.ts create mode 100644 lib/util/index.js create mode 100644 lib/util/index.js.map create mode 100644 operators/chunksOf.d.ts create mode 100644 operators/chunksOf.js create mode 100644 operators/chunksOf.js.map create mode 100644 operators/distinct.d.ts create mode 100644 operators/distinct.js create mode 100644 operators/distinct.js.map create mode 100644 operators/index.d.ts create mode 100644 operators/index.js create mode 100644 operators/index.js.map create mode 100644 operators/nonNullable.d.ts create mode 100644 operators/nonNullable.js create mode 100644 operators/nonNullable.js.map create mode 100644 operators/onlyIfChanged.d.ts create mode 100644 operators/onlyIfChanged.js create mode 100644 operators/onlyIfChanged.js.map create mode 100644 operators/scan.d.ts create mode 100644 operators/scan.js create mode 100644 operators/scan.js.map create mode 100644 operators/throttleTime.d.ts create mode 100644 operators/throttleTime.js create mode 100644 operators/throttleTime.js.map create mode 100644 operators/to.d.ts create mode 100644 operators/to.js create mode 100644 operators/to.js.map create mode 100644 test/getHandlerPr.d.ts create mode 100644 test/getHandlerPr.js create mode 100644 test/getHandlerPr.js.map create mode 100644 test/index.d.ts create mode 100644 test/index.js create mode 100644 test/index.js.map create mode 100644 test/mod.d.ts create mode 100644 test/mod.js create mode 100644 test/mod.js.map create mode 100644 test/test1.d.ts create mode 100644 test/test1.js create mode 100644 test/test1.js.map create mode 100644 test/test10.d.ts create mode 100644 test/test10.js create mode 100644 test/test10.js.map create mode 100644 test/test100.d.ts create mode 100644 test/test100.js create mode 100644 test/test100.js.map create mode 100644 test/test101.d.ts create mode 100644 test/test101.js create mode 100644 test/test101.js.map create mode 100644 test/test102.d.ts create mode 100644 test/test102.js create mode 100644 test/test102.js.map create mode 100644 test/test103.d.ts create mode 100644 test/test103.js create mode 100644 test/test103.js.map create mode 100644 test/test104.d.ts create mode 100644 test/test104.js create mode 100644 test/test104.js.map create mode 100644 test/test105.d.ts create mode 100644 test/test105.js create mode 100644 test/test105.js.map create mode 100644 test/test106.d.ts create mode 100644 test/test106.js create mode 100644 test/test106.js.map create mode 100644 test/test107.d.ts create mode 100644 test/test107.js create mode 100644 test/test107.js.map create mode 100644 test/test108.d.ts create mode 100644 test/test108.js create mode 100644 test/test108.js.map create mode 100644 test/test109.d.ts create mode 100644 test/test109.js create mode 100644 test/test109.js.map create mode 100644 test/test11.d.ts create mode 100644 test/test11.js create mode 100644 test/test11.js.map create mode 100644 test/test110.d.ts create mode 100644 test/test110.js create mode 100644 test/test110.js.map create mode 100644 test/test12.d.ts create mode 100644 test/test12.js create mode 100644 test/test12.js.map create mode 100644 test/test13.d.ts create mode 100644 test/test13.js create mode 100644 test/test13.js.map create mode 100644 test/test14.d.ts create mode 100644 test/test14.js create mode 100644 test/test14.js.map create mode 100644 test/test15.d.ts create mode 100644 test/test15.js create mode 100644 test/test15.js.map create mode 100644 test/test16.d.ts create mode 100644 test/test16.js create mode 100644 test/test16.js.map create mode 100644 test/test17.d.ts create mode 100644 test/test17.js create mode 100644 test/test17.js.map create mode 100644 test/test18.d.ts create mode 100644 test/test18.js create mode 100644 test/test18.js.map create mode 100644 test/test19.d.ts create mode 100644 test/test19.js create mode 100644 test/test19.js.map create mode 100644 test/test2.d.ts create mode 100644 test/test2.js create mode 100644 test/test2.js.map create mode 100644 test/test20.d.ts create mode 100644 test/test20.js create mode 100644 test/test20.js.map create mode 100644 test/test21.d.ts create mode 100644 test/test21.js create mode 100644 test/test21.js.map create mode 100644 test/test22.d.ts create mode 100644 test/test22.js create mode 100644 test/test22.js.map create mode 100644 test/test23.d.ts create mode 100644 test/test23.js create mode 100644 test/test23.js.map create mode 100644 test/test24.d.ts create mode 100644 test/test24.js create mode 100644 test/test24.js.map create mode 100644 test/test25.d.ts create mode 100644 test/test25.js create mode 100644 test/test25.js.map create mode 100644 test/test26.d.ts create mode 100644 test/test26.js create mode 100644 test/test26.js.map create mode 100644 test/test27.d.ts create mode 100644 test/test27.js create mode 100644 test/test27.js.map create mode 100644 test/test28.d.ts create mode 100644 test/test28.js create mode 100644 test/test28.js.map create mode 100644 test/test29.d.ts create mode 100644 test/test29.js create mode 100644 test/test29.js.map create mode 100644 test/test3.d.ts create mode 100644 test/test3.js create mode 100644 test/test3.js.map create mode 100644 test/test30.d.ts create mode 100644 test/test30.js create mode 100644 test/test30.js.map create mode 100644 test/test31.d.ts create mode 100644 test/test31.js create mode 100644 test/test31.js.map create mode 100644 test/test32.d.ts create mode 100644 test/test32.js create mode 100644 test/test32.js.map create mode 100644 test/test33.d.ts create mode 100644 test/test33.js create mode 100644 test/test33.js.map create mode 100644 test/test34.d.ts create mode 100644 test/test34.js create mode 100644 test/test34.js.map create mode 100644 test/test35.d.ts create mode 100644 test/test35.js create mode 100644 test/test35.js.map create mode 100644 test/test36.d.ts create mode 100644 test/test36.js create mode 100644 test/test36.js.map create mode 100644 test/test37.d.ts create mode 100644 test/test37.js create mode 100644 test/test37.js.map create mode 100644 test/test38.d.ts create mode 100644 test/test38.js create mode 100644 test/test38.js.map create mode 100644 test/test39.d.ts create mode 100644 test/test39.js create mode 100644 test/test39.js.map create mode 100644 test/test4.d.ts create mode 100644 test/test4.js create mode 100644 test/test4.js.map create mode 100644 test/test44.d.ts create mode 100644 test/test44.js create mode 100644 test/test44.js.map create mode 100644 test/test49.d.ts create mode 100644 test/test49.js create mode 100644 test/test49.js.map create mode 100644 test/test5.d.ts create mode 100644 test/test5.js create mode 100644 test/test5.js.map create mode 100644 test/test50.d.ts create mode 100644 test/test50.js create mode 100644 test/test50.js.map create mode 100644 test/test51.d.ts create mode 100644 test/test51.js create mode 100644 test/test51.js.map create mode 100644 test/test52.d.ts create mode 100644 test/test52.js create mode 100644 test/test52.js.map create mode 100644 test/test53.d.ts create mode 100644 test/test53.js create mode 100644 test/test53.js.map create mode 100644 test/test54.d.ts create mode 100644 test/test54.js create mode 100644 test/test54.js.map create mode 100644 test/test55.d.ts create mode 100644 test/test55.js create mode 100644 test/test55.js.map create mode 100644 test/test56.d.ts create mode 100644 test/test56.js create mode 100644 test/test56.js.map create mode 100644 test/test57.d.ts create mode 100644 test/test57.js create mode 100644 test/test57.js.map create mode 100644 test/test59.d.ts create mode 100644 test/test59.js create mode 100644 test/test59.js.map create mode 100644 test/test6.d.ts create mode 100644 test/test6.js create mode 100644 test/test6.js.map create mode 100644 test/test60.d.ts create mode 100644 test/test60.js create mode 100644 test/test60.js.map create mode 100644 test/test61.d.ts create mode 100644 test/test61.js create mode 100644 test/test61.js.map create mode 100644 test/test62.d.ts create mode 100644 test/test62.js create mode 100644 test/test62.js.map create mode 100644 test/test63.d.ts create mode 100644 test/test63.js create mode 100644 test/test63.js.map create mode 100644 test/test64.d.ts create mode 100644 test/test64.js create mode 100644 test/test64.js.map create mode 100644 test/test65.d.ts create mode 100644 test/test65.js create mode 100644 test/test65.js.map create mode 100644 test/test66.d.ts create mode 100644 test/test66.js create mode 100644 test/test66.js.map create mode 100644 test/test67.d.ts create mode 100644 test/test67.js create mode 100644 test/test67.js.map create mode 100644 test/test68.d.ts create mode 100644 test/test68.js create mode 100644 test/test68.js.map create mode 100644 test/test69.d.ts create mode 100644 test/test69.js create mode 100644 test/test69.js.map create mode 100644 test/test7.d.ts create mode 100644 test/test7.js create mode 100644 test/test7.js.map create mode 100644 test/test70.d.ts create mode 100644 test/test70.js create mode 100644 test/test70.js.map create mode 100644 test/test71.d.ts create mode 100644 test/test71.js create mode 100644 test/test71.js.map create mode 100644 test/test73.d.ts create mode 100644 test/test73.js create mode 100644 test/test73.js.map create mode 100644 test/test76.d.ts create mode 100644 test/test76.js create mode 100644 test/test76.js.map create mode 100644 test/test78.d.ts create mode 100644 test/test78.js create mode 100644 test/test78.js.map create mode 100644 test/test79.d.ts create mode 100644 test/test79.js create mode 100644 test/test79.js.map create mode 100644 test/test8.d.ts create mode 100644 test/test8.js create mode 100644 test/test8.js.map create mode 100644 test/test80.d.ts create mode 100644 test/test80.js create mode 100644 test/test80.js.map create mode 100644 test/test81.d.ts create mode 100644 test/test81.js create mode 100644 test/test81.js.map create mode 100644 test/test82.d.ts create mode 100644 test/test82.js create mode 100644 test/test82.js.map create mode 100644 test/test83.d.ts create mode 100644 test/test83.js create mode 100644 test/test83.js.map create mode 100644 test/test84.d.ts create mode 100644 test/test84.js create mode 100644 test/test84.js.map create mode 100644 test/test85.d.ts create mode 100644 test/test85.js create mode 100644 test/test85.js.map create mode 100644 test/test86.d.ts create mode 100644 test/test86.js create mode 100644 test/test86.js.map create mode 100644 test/test87.d.ts create mode 100644 test/test87.js create mode 100644 test/test87.js.map create mode 100644 test/test88.d.ts create mode 100644 test/test88.js create mode 100644 test/test88.js.map create mode 100644 test/test9.d.ts create mode 100644 test/test9.js create mode 100644 test/test9.js.map create mode 100644 test/test90.d.ts create mode 100644 test/test90.js create mode 100644 test/test90.js.map create mode 100644 test/test91.d.ts create mode 100644 test/test91.js create mode 100644 test/test91.js.map create mode 100644 test/test92.d.ts create mode 100644 test/test92.js create mode 100644 test/test92.js.map create mode 100644 test/test93.d.ts create mode 100644 test/test93.js create mode 100644 test/test93.js.map create mode 100644 test/test94.d.ts create mode 100644 test/test94.js create mode 100644 test/test94.js.map create mode 100644 test/test95.d.ts create mode 100644 test/test95.js create mode 100644 test/test95.js.map create mode 100644 test/test96.d.ts create mode 100644 test/test96.js create mode 100644 test/test96.js.map create mode 100644 test/test97.d.ts create mode 100644 test/test97.js create mode 100644 test/test97.js.map create mode 100644 test/test98.d.ts create mode 100644 test/test98.js create mode 100644 test/test98.js.map create mode 100644 test/test99.d.ts create mode 100644 test/test99.js create mode 100644 test/test99.js.map create mode 100644 test/types/Evt.create.d.ts create mode 100644 test/types/Evt.create.js create mode 100644 test/types/Evt.create.js.map create mode 100644 test/types/EvtLike.d.ts create mode 100644 test/types/EvtLike.js create mode 100644 test/types/EvtLike.js.map create mode 100644 test/types/EvtLikeToEvt.d.ts create mode 100644 test/types/EvtLikeToEvt.js create mode 100644 test/types/EvtLikeToEvt.js.map create mode 100644 test/types/UnpackEvt.d.ts create mode 100644 test/types/UnpackEvt.js create mode 100644 test/types/UnpackEvt.js.map create mode 100644 tools/Deferred.d.ts create mode 100644 tools/Deferred.js create mode 100644 tools/Deferred.js.map create mode 100644 tools/concatUint8Array.d.ts create mode 100644 tools/concatUint8Array.js create mode 100644 tools/concatUint8Array.js.map create mode 100644 tools/inDepth/copy.d.ts create mode 100644 tools/inDepth/copy.js create mode 100644 tools/inDepth/copy.js.map create mode 100644 tools/inDepth/getPrototypeChain.d.ts create mode 100644 tools/inDepth/getPrototypeChain.js create mode 100644 tools/inDepth/getPrototypeChain.js.map create mode 100644 tools/inDepth/index.d.ts create mode 100644 tools/inDepth/index.js create mode 100644 tools/inDepth/index.js.map create mode 100644 tools/inDepth/same.d.ts create mode 100644 tools/inDepth/same.js create mode 100644 tools/inDepth/same.js.map create mode 100644 tools/inDepth/test.d.ts create mode 100644 tools/inDepth/test.js create mode 100644 tools/inDepth/test.js.map create mode 100644 tools/inDepth/types.d.ts create mode 100644 tools/inDepth/types.js create mode 100644 tools/inDepth/types.js.map create mode 100644 tools/isCallableFunction.d.ts create mode 100644 tools/isCallableFunction.js create mode 100644 tools/isCallableFunction.js.map create mode 100644 tools/minimal-polyfills/LightMap.d.ts create mode 100644 tools/minimal-polyfills/LightMap.js create mode 100644 tools/minimal-polyfills/LightMap.js.map create mode 100644 tools/minimal-polyfills/LightSet.d.ts create mode 100644 tools/minimal-polyfills/LightSet.js create mode 100644 tools/minimal-polyfills/LightSet.js.map create mode 100644 tools/powerhooks/tools/useEffectRunConditionToDependencyArray.d.ts create mode 100644 tools/powerhooks/tools/useEffectRunConditionToDependencyArray.js create mode 100644 tools/powerhooks/tools/useEffectRunConditionToDependencyArray.js.map create mode 100644 tools/powerhooks/useEffectIf.d.ts create mode 100644 tools/powerhooks/useEffectIf.js create mode 100644 tools/powerhooks/useEffectIf.js.map create mode 100644 tools/powerhooks/useGuaranteedMemo.d.ts create mode 100644 tools/powerhooks/useGuaranteedMemo.js create mode 100644 tools/powerhooks/useGuaranteedMemo.js.map create mode 100644 tools/reducers/allEquals.d.ts create mode 100644 tools/reducers/allEquals.js create mode 100644 tools/reducers/allEquals.js.map create mode 100644 tools/reducers/allEqualsTo.d.ts create mode 100644 tools/reducers/allEqualsTo.js create mode 100644 tools/reducers/allEqualsTo.js.map create mode 100644 tools/reducers/allUniq.d.ts create mode 100644 tools/reducers/allUniq.js create mode 100644 tools/reducers/allUniq.js.map create mode 100644 tools/reducers/and.d.ts create mode 100644 tools/reducers/and.js create mode 100644 tools/reducers/and.js.map create mode 100644 tools/reducers/contains.d.ts create mode 100644 tools/reducers/contains.js create mode 100644 tools/reducers/contains.js.map create mode 100644 tools/reducers/count.d.ts create mode 100644 tools/reducers/count.js create mode 100644 tools/reducers/count.js.map create mode 100644 tools/reducers/diff.d.ts create mode 100644 tools/reducers/diff.js create mode 100644 tools/reducers/diff.js.map create mode 100644 tools/reducers/every.d.ts create mode 100644 tools/reducers/every.js create mode 100644 tools/reducers/every.js.map create mode 100644 tools/reducers/includes.d.ts create mode 100644 tools/reducers/includes.js create mode 100644 tools/reducers/includes.js.map create mode 100644 tools/reducers/index.d.ts create mode 100644 tools/reducers/index.js create mode 100644 tools/reducers/index.js.map create mode 100644 tools/reducers/or.d.ts create mode 100644 tools/reducers/or.js create mode 100644 tools/reducers/or.js.map create mode 100644 tools/reducers/partition.d.ts create mode 100644 tools/reducers/partition.js create mode 100644 tools/reducers/partition.js.map create mode 100644 tools/reducers/reduceify.d.ts create mode 100644 tools/reducers/reduceify.js create mode 100644 tools/reducers/reduceify.js.map create mode 100644 tools/reducers/removeDuplicates.d.ts create mode 100644 tools/reducers/removeDuplicates.js create mode 100644 tools/reducers/removeDuplicates.js.map create mode 100644 tools/reducers/sameAs.d.ts create mode 100644 tools/reducers/sameAs.js create mode 100644 tools/reducers/sameAs.js.map create mode 100644 tools/reducers/test.d.ts create mode 100644 tools/reducers/test.js create mode 100644 tools/reducers/test.js.map create mode 100644 tools/safeSetTimeout.d.ts create mode 100644 tools/safeSetTimeout.js create mode 100644 tools/safeSetTimeout.js.map create mode 100644 tools/testing/getPromiseAssertionApi.d.ts create mode 100644 tools/testing/getPromiseAssertionApi.js create mode 100644 tools/testing/getPromiseAssertionApi.js.map create mode 100644 tools/testing/index.d.ts create mode 100644 tools/testing/index.js create mode 100644 tools/testing/index.js.map create mode 100644 tools/tsafe/capitalize.d.ts create mode 100644 tools/tsafe/capitalize.js create mode 100644 tools/tsafe/capitalize.js.map create mode 100644 tsconfig.tsbuildinfo diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml deleted file mode 100644 index daf83ff5..00000000 --- a/.github/FUNDING.yml +++ /dev/null @@ -1,4 +0,0 @@ -# These are supported funding model platforms - -github: [garronej] -custom: ['https://www.ringerhq.com/experts/garronej'] diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml deleted file mode 100644 index c1d833d3..00000000 --- a/.github/workflows/ci.yaml +++ /dev/null @@ -1,147 +0,0 @@ -name: ci -on: - push: - branches: - - main - pull_request: - branches: - - main - -jobs: - - test_node: - runs-on: ${{ matrix.os }} - strategy: - matrix: - node: [ '14', '21' ] - os: [ windows-latest, ubuntu-latest ] - name: Test with Node v${{ matrix.node }} on ${{ matrix.os }} - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node }} - - uses: bahmutov/npm-install@v1 - - run: yarn build - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - run: yarn test:node - test_deno: - runs-on: ubuntu-latest - name: test with Deno - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: '15' - - name: Cache - uses: actions/cache@v3 - with: - path: ~/.cache/deno - key: deno-${{ runner.os }}-${{ hashFiles('deno-lock.json') }} - restore-keys: | - deno-${{ runner.os }}-${{ hashFiles('deno-lock.json') }} - deno-${{ runner.os }}- - deno- - - uses: denoland/setup-deno@v1 - with: - deno-version: v1.x - - run: deno --version - - uses: bahmutov/npm-install@v1 - - run: yarn build - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - run: yarn test:deno - check_if_version_upgraded: - name: Check if version upgrade - # We run this only if it's a push on the default branch or if it's a PR from a - # branch (meaning not a PR from a fork). It would be more straightforward to test if secrets.NPM_TOKEN is - # defined but GitHub Action don't allow it yet. - if: | - github.event_name == 'push' || - github.event.pull_request.head.repo.owner.login == github.event.pull_request.base.repo.owner.login - runs-on: ubuntu-latest - needs: - - test_node - - test_deno - outputs: - from_version: ${{ steps.step1.outputs.from_version }} - to_version: ${{ steps.step1.outputs.to_version }} - is_upgraded_version: ${{ steps.step1.outputs.is_upgraded_version }} - is_pre_release: ${{steps.step1.outputs.is_pre_release }} - steps: - - uses: garronej/ts-ci@v2.1.0 - id: step1 - with: - action_name: is_package_json_version_upgraded - branch: ${{ github.head_ref || github.ref }} - - publish: - runs-on: ubuntu-latest - needs: - - check_if_version_upgraded - # We create a release only if the version have been upgraded and we are on the main branch - # or if we are on a branch of the repo that has an PR open on main. - if: | - needs.check_if_version_upgraded.outputs.is_upgraded_version == 'true' && - ( - github.event_name == 'push' || - needs.check_if_version_upgraded.outputs.is_pre_release == 'true' - ) - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - ref: ${{ github.ref }} - - run: rm -r .github - - name: Remove tmp_branch if it exists - run: git push origin :tmp_branch || true - - run: git checkout -b tmp_branch - - uses: actions/setup-node@v3 - with: - registry-url: https://registry.npmjs.org/ - - uses: bahmutov/npm-install@v1 - - run: yarn build - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - run: | - npx -y -p denoify@1.5.6 enable_short_npm_import_path - npx -y -p denoify@1.5.6 remove_deno_dist_from_gitignore - env: - DRY_RUN: "0" - - run: | - if [ "$(npm show . version)" = "$VERSION" ]; then - echo "This version is already published" - exit 0 - fi - if [ "$NODE_AUTH_TOKEN" = "" ]; then - echo "Can't publish on NPM, You must first create a secret called NPM_TOKEN that contains your NPM auth token. https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets" - false - fi - EXTRA_ARGS="" - if [ "$IS_PRE_RELEASE" = "true" ]; then - EXTRA_ARGS="--tag next" - fi - npm publish $EXTRA_ARGS - env: - NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} - VERSION: ${{ needs.check_if_version_upgraded.outputs.to_version }} - IS_PRE_RELEASE: ${{ needs.check_if_version_upgraded.outputs.is_pre_release }} - - run: | - git config --global user.name "actions" - git config --global user.email actions@github.com - git add -A - git commit -am "Adding deno distribution files and moving files from /dist to /" - git push origin tmp_branch - - uses: softprops/action-gh-release@v1 - with: - name: Release v${{ needs.check_if_version_upgraded.outputs.to_version }} - tag_name: v${{ needs.check_if_version_upgraded.outputs.to_version }} - target_commitish: tmp_branch - generate_release_notes: false - draft: false - prerelease: ${{ needs.check_if_version_upgraded.outputs.is_pre_release == 'true' }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Remove tmp_branch - run: git push origin :tmp_branch diff --git a/.gitignore b/.gitignore index 7371373f..13be271a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,46 +1,2 @@ -# Logs -logs -*.log -npm-debug.log* - -# Runtime data -pids -*.pid -*.seed - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage - -# nyc test coverage -.nyc_output - -# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# node-waf configuration -.lock-wscript - -# Compiled binary addons (http://nodejs.org/api/addons.html) -build/Release - -# Dependency directories -node_modules -jspm_packages - -# Optional npm cache directory -.npm - -# Optional REPL history -.node_repl_history - -dist/test -.vscode - -.DS_Store - - -/dist -/deno_dist \ No newline at end of file + +/node_modules diff --git a/deno_dist/LICENSE b/deno_dist/LICENSE new file mode 100644 index 00000000..61f220f7 --- /dev/null +++ b/deno_dist/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 GitHub user u/garronej + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/deno_dist/README.md b/deno_dist/README.md new file mode 100644 index 00000000..fab8a6b4 --- /dev/null +++ b/deno_dist/README.md @@ -0,0 +1,121 @@ +

+ +

+

+ 💧EventEmitter's typesafe replacement💧 +
+
+ + + + + + + + + + + + + + + + + + +

+ +

+

+ Home + - + Documentation +

+ +--- + +`'evt'` is intended to be a replacement for `'events'`. +It makes heavy use of **typescript**'s type inference features to provide **type safety** while keeping things **concise and elegant** 🍸. + +Suitable for any JS runtime env (deno, node, old browsers, react-native ...) +- ✅ It is both a [Deno](https://deno.land/x/evt) and an [NPM](https://www.npmjs.com/evt) module. ( Achieved with [Denoify](https://github.com/garronej/denoify) ) +- ✅ No external dependencies ([`tsafe`](https://github.com/garronej/tsafe), [`run-exclusive`](https://github.com/garronej/run_exclusive) and [`minimal-polyfills`](https://github.com/garronej/minimal_polyfills) are all from the same author as EVT). +- ✅ [Makes it easy to work with events in React](https://docs.evt.land/react-hooks). + +Can be imported in TypeScript projects using version TypeScript >= 3.8 (February 20th, 2020) and in any plain JS projects. + +> NOTE: There is very few breaking changes from v1 to v2. [Check them out](https://docs.evt.land/v1-greater-than-v2). + +# Who is using it + +

+ + + + + + +
+ + + + + + + + + +

+ +# Install / Import + +## In Deno: +```typescript +import { Evt } from "https://deno.land/x/evt/mod.ts"; +``` +## Anywhere else: +```bash +$ npm install --save evt +``` +```typescript +import { Evt } from "evt"; +``` + +# Try it + +

+ + Playground +

+ +# Motivations + +There are a lot of things that can't easily be done with `EventEmitter`: + +* Enforcing **type safety**. +* Removing a particular listener ( if the callback is an anonymous function ). +* Adding a one-time listener for the next event that meets a condition. +* Waiting \(via a Promise\) for one thing or another to happen. +_Example: waiting at most one second for the next message, stop waiting if the socket disconnects._ + +Why would someone pick EVT over RxJS: + +* EVT's learning curve is not as steep as RxJS's. +* Generates code that is easier to grasp for people not familiar with reactive programming. + +EVT is an attempt to address all these points while trying to remain as accessible as `EventEmitter`. + +
+ +

+ Get Started +

+ +# The sticker + +

+ +

+

+ Shop +

diff --git a/deno_dist/hooks/index.ts b/deno_dist/hooks/index.ts new file mode 100644 index 00000000..f2a4672c --- /dev/null +++ b/deno_dist/hooks/index.ts @@ -0,0 +1,9 @@ +/* +NOTE: In theory react should be a peer dependency +instead of a dev dependency. +But given that /hook is just a plugin for using Evt +with react we don't want to require react to be +installed to install Evt. +*/ +export { useEvt } from "./useEvt.ts"; +export { useRerenderOnStateChange } from "./useRerenderOnStateChange.ts"; \ No newline at end of file diff --git a/deno_dist/hooks/useEvt.ts b/deno_dist/hooks/useEvt.ts new file mode 100644 index 00000000..3ea7584a --- /dev/null +++ b/deno_dist/hooks/useEvt.ts @@ -0,0 +1,51 @@ +import { Evt } from "../lib/index.ts"; +import type { Ctx } from "../lib/index.ts"; +import React from "https://dev.jspm.io/react@18.2.0";; +const { useEffect } = React; + + +/** + * https://docs.evt.land/api/react-hooks + * + * Provide a Ctx to attach handlers. + * You should list in deps all the Evt that are + * susceptible to change ( Evt passed as props + * or Evt that are react states ) that you use in the + * factoryOrEffect callback. + * As for useEffect you should also list every other + * value that you use. + * Whenever any value in deps is changed factoryOrEffect + * is invoked again with the new Evt and the previous handler + * get detached. + * All handler are also detached when the component unmount. + * + * factoryOrEffect can be used for attaching handler to event + * or to generate a new event that is a merge/pipe of other + * Evts. + * + * BE AWARE: Unlike useEffect factoryOrEffect is called + * on render ( like useMemo's callback ). + * Remember that you shouldn't update state in a component + * render tick (in the useMemo for example). If you you need to + * perform an effect on first render (attaching a stateful evt + * for example) use registerSideEffect(()=>{ ... }) + * + * Demo: https://docs.evt.land/react-hooks#useevt + */ +export function useEvt( + effect: (ctx: Ctx) => void, + deps?: React.DependencyList +): void { + + useEffect( + ()=> { + const ctx= Evt.newCtx(); + + effect(ctx); + + return ()=> { ctx.done(); }; + }, + deps + ); + +} diff --git a/deno_dist/hooks/useRerenderOnStateChange.ts b/deno_dist/hooks/useRerenderOnStateChange.ts new file mode 100644 index 00000000..cf3b8e4c --- /dev/null +++ b/deno_dist/hooks/useRerenderOnStateChange.ts @@ -0,0 +1,27 @@ +import { useEvt } from "./useEvt.ts"; +import React from "https://dev.jspm.io/react@18.2.0";; +const { useState } = React; + +type CtxLike = import("../lib/types/interfaces/CtxLike.ts").CtxLike; + +interface StatefulReadonlyEvtLike { + state: unknown; + attach: (ctx: CtxLike, cb: (state: unknown)=> void)=> void; +}; + +/** + * https://docs.evt.land/react-hooks#usererenderonstatechange + * + * To use StatefulEvt as react component state. + * */ +export function useRerenderOnStateChange(evt: StatefulReadonlyEvtLike): void { + + //NOTE: We use function in case the state is a function + const [, setState] = useState(() => evt.state); + + useEvt( + ctx => + evt.attach(ctx, state => setState(() => state)), + [evt] + ); +} diff --git a/deno_dist/lib/Ctx.ts b/deno_dist/lib/Ctx.ts new file mode 100644 index 00000000..eb88eb40 --- /dev/null +++ b/deno_dist/lib/Ctx.ts @@ -0,0 +1,166 @@ +import { assert } from "https://deno.land/x/tsafe@v1.6.6/assert.ts";; +import { is } from "https://deno.land/x/tsafe@v1.6.6/is.ts"; +import { LazyEvt } from "./LazyEvt.ts"; +import { importProxy } from "./importProxy.ts"; +import { overwriteReadonlyProp } from "https://deno.land/x/tsafe@v1.6.6/lab/overwriteReadonlyProp.ts"; + +import type { + Handler, + NonPostableEvtLike, + Evt, + CtxLike, + DoneOrAborted +} from "./types/index.ts"; + +export type Ctx = import("./types/interfaces/index.ts").Ctx; + +class CtxImpl implements Ctx{ + + + get evtDoneOrAborted(): Evt> { + return this.lazyEvtDoneOrAborted.evt; + } + + get evtAttach(): Evt> { + return this.lazyEvtAttach.evt; + } + + get evtDetach(): Evt> { + return this.lazyEvtDetach.evt; + } + + private __completionStatus: DoneOrAborted | undefined; + + get completionStatus(): DoneOrAborted | undefined { + return this.__completionStatus; + } + + + private lazyEvtAttach = new LazyEvt>(); + private lazyEvtDetach = new LazyEvt>(); + private lazyEvtDoneOrAborted = new LazyEvt>(); + + private onDoneOrAborted(doneOrAborted: DoneOrAborted): void { + + this.__completionStatus = doneOrAborted; + + this.lazyEvtDoneOrAborted.post(doneOrAborted); + } + + waitFor(timeout?: number): Promise { + return this.evtDoneOrAborted + .waitFor(timeout) + .then( + data => { + if (data.type === "ABORTED") { + throw data.error; + } + return data.result; + }, + timeoutError => { + this.abort(timeoutError); + throw timeoutError; + } + ) + ; + } + + + abort(error: Error) { + return this.__done(error); + } + + done(result: Result) { + return this.__done(undefined, result); + } + + /** Detach all handler bound to this context from theirs respective Evt and post getEvtDone() */ + private __done(error: Error | undefined, result?: Result): Handler.WithEvt[] { + + const handlers: Handler.WithEvt[] = []; + + for (const handler of this.handlers.values()) { + + const evt = this.evtByHandler.get(handler)!; + + const wasStillAttached = handler.detach(); + + //NOTE: It should not be possible + if (!wasStillAttached) { + continue; + } + + handlers.push({ handler, evt }); + } + + this.onDoneOrAborted({ + ...(!!error ? + { type: "ABORTED", error } : + { type: "DONE", "result": result as NonNullable } + ), + handlers + }); + + + return handlers; + + } + + private handlers = new Set< + Handler> + >(); + private evtByHandler = new WeakMap< + Handler>, + NonPostableEvtLike + >(); + + getHandlers(): Handler.WithEvt[] { + return Array.from(this.handlers.values()) + .map(handler => ({ handler, "evt": this.evtByHandler.get(handler)! })) + ; + } + + + zz__addHandler( + handler: Handler>, + evt: NonPostableEvtLike + ) { + assert(handler.ctx === this); + assert(is>>(handler)); + + if( this.completionStatus !== undefined ){ + handler.detach(); + return; + } + + this.handlers.add(handler); + this.evtByHandler.set(handler, evt); + this.lazyEvtAttach.post({ handler, evt }); + } + + zz__removeHandler( + handler: Handler>, + ) { + assert(handler.ctx === this); + assert(is>>(handler)); + + this.lazyEvtDetach.post({ + handler, + "evt": this.evtByHandler.get(handler)! + }); + + this.handlers.delete(handler); + } + +} + +export const Ctx: { + new (): Ctx; + readonly prototype: Ctx; +} = CtxImpl; + +try{ overwriteReadonlyProp(Ctx as any, "name", "Ctx"); }catch{} + +importProxy.Ctx = Ctx; + + diff --git a/deno_dist/lib/Evt.asNonPostable.ts b/deno_dist/lib/Evt.asNonPostable.ts new file mode 100644 index 00000000..e71461fc --- /dev/null +++ b/deno_dist/lib/Evt.asNonPostable.ts @@ -0,0 +1,7 @@ + +import type { ToNonPostableEvt, NonPostableEvtLike } from "./types/index.ts"; + +/** https://docs.evt.land/api/evt/asnonpostable */ +export function asNonPostable>(evt: E): ToNonPostableEvt{ + return evt as any; +} \ No newline at end of file diff --git a/deno_dist/lib/Evt.asPostable.ts b/deno_dist/lib/Evt.asPostable.ts new file mode 100644 index 00000000..e0fafe6f --- /dev/null +++ b/deno_dist/lib/Evt.asPostable.ts @@ -0,0 +1,11 @@ +import type { NonPostableEvtLike, ToPostableEvt } from "./types/index.ts"; + +/** + * @deprecated: ⚠ UNSAFE ⚠ - Please don't use it, it will be removed in the next + * major release. + * https://docs.evt.land/api/evt/aspostable + * */ +export function asPostable>(evt: E): ToPostableEvt{ + return evt as any; +} + diff --git a/deno_dist/lib/Evt.asyncPipe.ts b/deno_dist/lib/Evt.asyncPipe.ts new file mode 100644 index 00000000..ac4c3fb6 --- /dev/null +++ b/deno_dist/lib/Evt.asyncPipe.ts @@ -0,0 +1,77 @@ + +import type { Evt } from "./Evt.ts"; +import type { StatefulEvt, UnpackEvt, NonPostableEvtLike, StatefulReadonlyEvtLike } from "./types/index.ts"; +import type { PromiseOrNot } from "https://deno.land/x/tsafe@v1.6.6/lab/PromiseOrNot.ts"; +import { importProxy } from "./importProxy.ts"; + + + +/** + * NOTE: Workaround until v2.0 where .pipe() will support async operators + * Usage example: https://stackblitz.com/edit/evt-async-op?file=index.ts + * + * When the argument is a StatefulEvt: + * If, wile asyncOp was running, the state of the source evt + * have changed then the result will be discarded. + * + * If the asyncOp complete synchronously (meaning it does not return + * a promise) then the result is synchronously transformed. (As with .pipe() ) + * + * More usage example in src/test/test95.ts + */ +export function asyncPipe, U>( + evt: E, + asyncOp: (data: UnpackEvt) => PromiseOrNot<[U] | null> +): + E extends StatefulReadonlyEvtLike ? StatefulEvt : Evt +{ + + const out = "state" in evt ? + importProxy.Evt.create | undefined>(undefined) : + importProxy.Evt.create>(); + + let currentCallCount = 0; + + evt.attach(async (data: UnpackEvt) => { + + currentCallCount++; + + const thisCallCount = currentCallCount; + + const prOpResult = asyncOp(data); + + let opResult: [U] | null; + + if ( + prOpResult !== null && + "then" in prOpResult + ) { + + opResult = await prOpResult; + + if ( + "state" in evt && + thisCallCount !== currentCallCount + ) { + return; + } + + } else { + + opResult = prOpResult; + + } + + if (!opResult) { + + return; + } + + out.post(opResult[0] as any); + + }); + + return out as any; + +} + diff --git a/deno_dist/lib/Evt.create.ts b/deno_dist/lib/Evt.create.ts new file mode 100644 index 00000000..50f9dc3d --- /dev/null +++ b/deno_dist/lib/Evt.create.ts @@ -0,0 +1,22 @@ + +import { importProxy } from "./importProxy.ts"; +import type { Evt, StatefulEvt, NonPostableEvtLike, UnpackEvt } from "./types/index.ts"; + +export function create | undefined = NonPostableEvtLike>(): Evt>; +/** + * https://docs.evt.land/api/evt/create + * Return a new Evt instance. + */ +export function create(): Evt; +/** + * https://docs.evt.land/api/evt/create + * Return a new StatefulEvt instance. + */ +export function create(initialState: T ): StatefulEvt; +export function create | undefined>(initialState: UnpackEvt ): StatefulEvt>; +export function create(...args: [] | [any] ): Evt | StatefulEvt { + return args.length === 0 ? + new importProxy.Evt() : + new importProxy.StatefulEvt(args[0]) + ; +} \ No newline at end of file diff --git a/deno_dist/lib/Evt.factorize.ts b/deno_dist/lib/Evt.factorize.ts new file mode 100644 index 00000000..ef427d50 --- /dev/null +++ b/deno_dist/lib/Evt.factorize.ts @@ -0,0 +1,14 @@ +import type { FactorizeEvt, NonPostableEvtLike } from "./types/index.ts"; + +/** https://docs.evt.land/api/evt/factorize */ +export function factorize>( + evt: E +): FactorizeEvt { + return evt as any; +} + +/* +import { Evt } from "./Evt.ts"; +const x: Evt = loosenType(new Evt()); x; +const y: Evt = loosenType(new Evt()); y; +*/ \ No newline at end of file diff --git a/deno_dist/lib/Evt.from.ts b/deno_dist/lib/Evt.from.ts new file mode 100644 index 00000000..067dfbbf --- /dev/null +++ b/deno_dist/lib/Evt.from.ts @@ -0,0 +1,335 @@ +import { id } from "https://deno.land/x/tsafe@v1.6.6/id.ts"; +import { assert } from "https://deno.land/x/tsafe@v1.6.6/assert.ts";; +import { typeGuard } from "https://deno.land/x/tsafe@v1.6.6/typeGuard.ts"; +import { mergeImpl } from "./Evt.merge.ts"; +import { importProxy } from "./importProxy.ts"; +import type { dom, Evt, NonPostableEvtLike } from "./types/index.ts"; +import type { EventTargetLike } from "./types/index.ts"; +import * as nsEventTargetLike from "./types/EventTargetLike.ts"; +const { EventTargetLike: EventTargetLikeAsValue } = nsEventTargetLike; +import type { ObserverConstructor } from "./types/Observer.ts"; + +type OneOrMany = T | ArrayLike; +type CtxLike = import("./types/index.ts").CtxLike & { + evtDoneOrAborted: NonPostableEvtLike & { postCount: number; attachOnce(callback: () => void): void; }; +}; + +function fromImplForTargetEventLike( + ctx: CtxLike | undefined, + target: OneOrMany> | PromiseLike, + eventName?: string, + options?: EventTargetLike.HasEventTargetAddRemove.Options +): Evt { + + const matchEventTargetLike = + (target_: typeof target): target_ is EventTargetLike => + EventTargetLikeAsValue.canBe(target_); + + if (!matchEventTargetLike(target)) { + + if ("then" in target) { + + const evt = new importProxy.Evt(); + + const isCtxDone = (() => { + + const getEvtDonePostCount = () => ctx?.evtDoneOrAborted.postCount; + + const n = getEvtDonePostCount(); + + return () => n !== getEvtDonePostCount(); + + })(); + + target.then(data => { + + if (isCtxDone()) { + return; + } + + evt.post(data); + + }); + + return evt; + + } + + return mergeImpl>( + ctx, + Array.from(target).map( + target => fromImplForTargetEventLike(ctx, target, eventName, options) + ) + ); + + } + + type ProxyMethod = ( + listener: (data: T) => void, + eventName: string, + options?: EventTargetLike.HasEventTargetAddRemove.Options + ) => void; + + let proxy: { + on: ProxyMethod; + off: ProxyMethod; + }; + + if (EventTargetLikeAsValue.HasEventTargetAddRemove.match(target)) { + proxy = { + "on": (listener, eventName, options) => target.addEventListener(eventName, listener, options), + "off": (listener, eventName, options) => target.removeEventListener(eventName, listener, options) + }; + } else if (EventTargetLikeAsValue.NodeStyleEventEmitter.match(target)) { + proxy = { + "on": (listener, eventName) => target.addListener(eventName, listener), + "off": (listener, eventName) => target.removeListener(eventName, listener) + }; + } else if (EventTargetLikeAsValue.JQueryStyleEventEmitter.match(target)) { + proxy = { + "on": (listener, eventName) => target.on(eventName, listener), + "off": (listener, eventName) => target.off(eventName, listener) + }; + } else if (EventTargetLikeAsValue.RxJSSubject.match(target)) { + + let subscription: EventTargetLike.RxJSSubject.Subscription; + + proxy = { + "on": listener => subscription = target.subscribe(data => listener(data)), + "off": () => subscription.unsubscribe() + }; + + } else { + + id(target); + assert(false); + + } + + const evt = new importProxy.Evt(); + + const listener = (data: T) => evt.post(data); + + ctx?.evtDoneOrAborted.attachOnce( + () => proxy.off( + listener, + eventName!, + options + ) + ); + + proxy.on(listener, eventName!, options); + + return evt; + +} + +function fromImplForObserver( + ctx: CtxLike | undefined, + ObserverConstructor: ObserverConstructor, + target: Target +): Evt { + + const evt = importProxy.Evt.create(); + + const listener = ([entry]: Entry[]) => evt.post(entry); + + const observer = new ObserverConstructor(listener); + + observer.observe(target); + + ctx?.evtDoneOrAborted.attachOnce( + () => observer.disconnect() + ); + + return evt; + +} + +/** https://docs.evt.land/api/evt/from */ +export function from( + ctx: CtxLike, + target: EventTargetLike.HTMLElement, + eventName: K, + options?: EventTargetLike.HasEventTargetAddRemove.Options +): Evt; + +export function from( + ctx: CtxLike, + target: EventTargetLike.Window, + eventName: K, + options?: EventTargetLike.HasEventTargetAddRemove.Options +): Evt; + +export function from( + ctx: CtxLike, + target: EventTargetLike.Document, + eventName: K, + options?: EventTargetLike.HasEventTargetAddRemove.Options +): Evt; + +export function from( + ctx: CtxLike, + target: OneOrMany< + EventTargetLike.NodeStyleEventEmitter | + EventTargetLike.JQueryStyleEventEmitter + >, + eventName: string +): Evt; +export function from( + ctx: CtxLike, + target: OneOrMany< + EventTargetLike.HasEventTargetAddRemove + >, + eventName: string, + options?: EventTargetLike.HasEventTargetAddRemove.Options +): Evt; +export function from( + ctx: CtxLike, + target: OneOrMany> +): Evt; + +export function from( + ctx: CtxLike, + target: PromiseLike +): Evt; + +export function from( + ctx: CtxLike, + ObserverConstructor: ObserverConstructor, + target: Target +): Evt; + + +export function from( + target: EventTargetLike.HTMLElement, + eventName: K, + options?: EventTargetLike.HasEventTargetAddRemove.Options +): Evt; +export function from( + target: EventTargetLike.Window, + eventName: K, + options?: EventTargetLike.HasEventTargetAddRemove.Options +): Evt; +export function from( + target: EventTargetLike.Document, + eventName: K, + options?: EventTargetLike.HasEventTargetAddRemove.Options +): Evt; +export function from( + target: OneOrMany< + EventTargetLike.NodeStyleEventEmitter | + EventTargetLike.JQueryStyleEventEmitter + >, + eventName: string +): Evt; +export function from( + target: OneOrMany< + EventTargetLike.HasEventTargetAddRemove + >, + eventName: string, + options?: EventTargetLike.HasEventTargetAddRemove.Options +): Evt; +export function from( + target: OneOrMany> +): Evt; +export function from( + target: PromiseLike +): Evt; + +export function from( + ObserverConstructor: ObserverConstructor, + target: Target +): Evt; +/* +/^[A-Z]/.test(targetOrEventNameOrObserverConstructorOrObserverTarget.name + */ + +export function from( + ctxOrTargetOrObserverConstructor: CtxLike | OneOrMany> | PromiseLike | ObserverConstructor, + targetOrEventNameOrObserverConstructorOrObserverTarget?: OneOrMany> | string | PromiseLike | ObserverConstructor | ObserverTarget, + eventNameOrOptionsOrObserverTarget?: string | EventTargetLike.HasEventTargetAddRemove.Options | ObserverTarget, + options?: EventTargetLike.HasEventTargetAddRemove.Options +): Evt { + + if ("evtDoneOrAborted" in ctxOrTargetOrObserverConstructor) { + + assert( + typeGuard> | PromiseLike | ObserverConstructor>(targetOrEventNameOrObserverConstructorOrObserverTarget, true) && + typeGuard(eventNameOrOptionsOrObserverTarget, true) && + typeGuard(options, true) + ); + + if (typeof targetOrEventNameOrObserverConstructorOrObserverTarget === "function") { + + assert( + typeGuard(eventNameOrOptionsOrObserverTarget, true) && + typeGuard(options, true) + ); + + return fromImplForObserver( + ctxOrTargetOrObserverConstructor, + targetOrEventNameOrObserverConstructorOrObserverTarget, + eventNameOrOptionsOrObserverTarget + ); + + } else { + + assert( + typeGuard>(eventNameOrOptionsOrObserverTarget, true) + ); + + return fromImplForTargetEventLike( + ctxOrTargetOrObserverConstructor, + targetOrEventNameOrObserverConstructorOrObserverTarget, + eventNameOrOptionsOrObserverTarget, + options + ); + + } + + + } else { + + assert( + typeGuard>>(ctxOrTargetOrObserverConstructor, true) && + typeGuard(targetOrEventNameOrObserverConstructorOrObserverTarget, true) && + typeGuard(eventNameOrOptionsOrObserverTarget, true) + ); + + if (typeof ctxOrTargetOrObserverConstructor === "function") { + + assert( + typeGuard(targetOrEventNameOrObserverConstructorOrObserverTarget, true) && + typeGuard(eventNameOrOptionsOrObserverTarget, true) + ); + + return fromImplForObserver( + undefined, + ctxOrTargetOrObserverConstructor, + targetOrEventNameOrObserverConstructorOrObserverTarget + ); + + + } else { + + assert( + typeGuard>( + targetOrEventNameOrObserverConstructorOrObserverTarget, true + ) + ); + + return fromImplForTargetEventLike( + undefined, + ctxOrTargetOrObserverConstructor, + targetOrEventNameOrObserverConstructorOrObserverTarget, + eventNameOrOptionsOrObserverTarget + ); + + } + + + + } + +} diff --git a/deno_dist/lib/Evt.getCtx.ts b/deno_dist/lib/Evt.getCtx.ts new file mode 100644 index 00000000..00682ce7 --- /dev/null +++ b/deno_dist/lib/Evt.getCtx.ts @@ -0,0 +1,33 @@ +import { importProxy } from "./importProxy.ts"; +import type { Ctx } from "./types/index.ts"; + +/** + * https://docs.evt.land/api/evt/getctx + * + * Evt.getCtx(obj) an instance of Ctx, always the same for a given object. + * No strong reference to the object is created + * when the object is no longer referenced it's associated Ctx will be freed from memory. + */ +export function getCtxFactory() { + + const ctxByObj = new WeakMap(); + + function getCtx(obj: object): Ctx { + + let ctx = ctxByObj.get(obj); + + if (ctx === undefined) { + + ctx = (new importProxy.Ctx()); + + ctxByObj.set(obj, ctx); + + } + + return ctx; + + } + + return getCtx; + +} diff --git a/deno_dist/lib/Evt.loosenType.ts b/deno_dist/lib/Evt.loosenType.ts new file mode 100644 index 00000000..e31370f6 --- /dev/null +++ b/deno_dist/lib/Evt.loosenType.ts @@ -0,0 +1,20 @@ +import type { SwapEvtType, UnpackEvt, NonPostableEvtLike} from "./types/index.ts"; + +/** + * https://docs.evt.land/api/evt/loosentype + */ +export function loosenType, SupersetOfT>( + evt: E +): UnpackEvt extends SupersetOfT ? + SwapEvtType : "NOT A SUPERSET" { + return evt as any; +} + +/* +import { Evt } from "./Evt.ts"; +const x: Evt = loosenType(new Evt()); x; +const y: Evt = loosenType(new Evt()); y; +*/ + + + diff --git a/deno_dist/lib/Evt.merge.ts b/deno_dist/lib/Evt.merge.ts new file mode 100644 index 00000000..5e5e5867 --- /dev/null +++ b/deno_dist/lib/Evt.merge.ts @@ -0,0 +1,51 @@ + +import { importProxy } from "./importProxy.ts"; +import type { UnpackEvt, Evt, CtxLike, NonPostableEvtLike } from "./types/index.ts"; + +export function mergeImpl>( + ctx: CtxLike | undefined, + evts: readonly EvtUnion[] +): Evt> { + + const evtUnion = new importProxy.Evt>(); + + const callback = (data: UnpackEvt) => evtUnion.post(data) + + evts.forEach( + evt => { + + if (ctx === undefined) { + evt.attach(callback); + } else { + evt.attach(ctx, callback); + } + + } + ); + + return evtUnion; + +} + + + +/** https://docs.evt.land/api/evt/merge */ +export function merge>( + ctx: CtxLike, + evts: readonly EvtUnion[] +): Evt>; +export function merge>( + evts: readonly EvtUnion[] +): Evt>; +export function merge>( + p1: CtxLike | readonly EvtUnion[], + p2?: readonly EvtUnion[] +): Evt> { + + return "length" in p1 ? + mergeImpl(undefined, p1) : + mergeImpl(p1, p2!) + ; + + +} \ No newline at end of file diff --git a/deno_dist/lib/Evt.newCtx.ts b/deno_dist/lib/Evt.newCtx.ts new file mode 100644 index 00000000..85ab1a15 --- /dev/null +++ b/deno_dist/lib/Evt.newCtx.ts @@ -0,0 +1,11 @@ +import { importProxy } from "./importProxy.ts"; +import type { Ctx } from "./Ctx.ts"; + +/** + * https://docs.evt.land/api/evt/newctx + * + * return a new Ctx instance + * */ +export function newCtx(): Ctx{ + return new importProxy.Ctx(); +} \ No newline at end of file diff --git a/deno_dist/lib/Evt.parsePropsFromArgs.ts b/deno_dist/lib/Evt.parsePropsFromArgs.ts new file mode 100644 index 00000000..c43de038 --- /dev/null +++ b/deno_dist/lib/Evt.parsePropsFromArgs.ts @@ -0,0 +1,250 @@ + +import type { Operator } from "./types/Operator.ts" +import { id } from "https://deno.land/x/tsafe@v1.6.6/id.ts"; +import { compose } from "./util/compose.ts"; +import { typeGuard } from "https://deno.land/x/tsafe@v1.6.6/typeGuard.ts" +import type { CtxLike, Handler } from "./types/index.ts"; + +export function matchAll() { return true; } + +const canBeOperator = (p: undefined | CtxLike | Operator): boolean => { + return ( + p !== undefined && + typeGuard>(p, true) && + ( + typeof p === "function" || + typeof p[0] === "function" + ) + ); +}; + +const defaultParams: Handler.PropsFromArgs = { + "op": matchAll, + "ctx": undefined, + "timeout": undefined, + "callback": undefined +}; + +export function parsePropsFromArgs( + inputs: readonly any[], + methodName: "waitFor" | "attach*" | "pipe" +): Handler.PropsFromArgs { + + type Out = Handler.PropsFromArgs; + + switch (methodName) { + case "pipe": { + + //[] + //[undefined] ( not valid but user would expect it to work ) + //[ ctx, ...op[] ] + //[ ...op[] ] + + const getOpWrap = (ops: [Operator, ...Operator[]]) => + ops.length === 0 ? + {} + : + { "op": ops.length === 1 ? ops[0] : compose(...ops) } + ; + + if (canBeOperator(inputs[0])) { + + //[ ...op[] ] + + return id({ + ...defaultParams, + ...getOpWrap(inputs as any) + }); + + } else { + + //[] + //[ ctx, ...Operator.fλ[] ] + + const [ctx, ...rest] = inputs; + + return id({ + ...defaultParams, + ...(ctx !== undefined ? { ctx } : {}), + ...getOpWrap(rest as any) + }); + + } + + + } break; + + case "waitFor": { + + //[ op, ctx, timeout ] + //[ op, ctx, undefined ] + //[ op, ctx ] + //[ op, timeout ] + //[ op, undefined ] + //[ ctx, timeout ] + //[ ctx, undefined ] + //[ op ] + //[ ctx ] + //[ timeout ] + //[ undefined ] + //[ callback ] + + return parsePropsFromArgs( + [ + //If the last element is undefined, remove it. + ...inputs.filter( + (value, index) => !( + index === inputs.length - 1 && + value === undefined + ) + ), + defaultParams.callback + ], + "attach*" + ); + + } break; + case "attach*": { + + //NOTE: when callback is undefined call has been forward from waitFor. + + //[ op, ctx, timeout, callback ] + //[ op, ctx, timeout, undefined ] + //[ op, ctx, callback ] + //[ op, ctx, undefined ] + //[ op, timeout, callback ] + //[ op, timeout, undefined ] + //[ ctx, timeout, callback ] + //[ ctx, timeout, undefined ] + //[ op, callback ] + //[ op, undefined ] + //[ ctx, callback ] + //[ ctx, undefined ] + //[ timeout, callback ] + //[ timeout, undefined ] + //[ callback ] + //[ undefined ] + + const n = inputs.length as 4 | 3 | 2 | 1 | 0; + + switch (n) { + case 4: { + + //[ op, ctx, timeout, callback ] + const [p1, p2, p3, p4] = inputs; + + return id({ + ...defaultParams, + "op": p1, + "ctx": p2, + "timeout": p3, + "callback": p4 + }); + + } + case 3: { + + //[ op, ctx, callback ] + //[ op, timeout, callback ] + //[ ctx, timeout, callback ] + const [p1, p2, p3] = inputs; + if (typeof p2 === "number") { + //[ op, timeout, callback ] + //[ ctx, timeout, callback ] + + const timeout: Out["timeout"] = p2; + const callback: Out["callback"] = p3; + + if (canBeOperator(p1)) { + //[ op, timeout, callback ] + return id({ + ...defaultParams, + timeout, + callback, + "op": p1 + }); + + } else { + //[ ctx, timeout, callback ] + + return id({ + ...defaultParams, + timeout, + callback, + "ctx": p1 + }); + + } + } else { + //[ op, ctx, callback ] + return id({ + ...defaultParams, + "op": p1, + "ctx": p2, + "callback": p3 + }); + + } + + } + case 2: { + + //[ op, callback ] + //[ ctx, callback ] + //[ timeout, callback ] + const [p1, p2] = inputs; + if (typeof p1 === "number") { + //[ timeout, callback ] + return id({ + ...defaultParams, + "timeout": p1, + "callback": p2 + }); + } else { + //[ op, callback ] + //[ ctx, callback ] + const callback: Out["callback"] = p2; + if (canBeOperator(p1)) { + + return id({ + ...defaultParams, + callback, + "op": p1 + }); + + } else { + + return id({ + ...defaultParams, + callback, + "ctx": p1 + }); + + } + } + + } + case 1: { + + //[ callback ] + const [p] = inputs; + + return id({ + ...defaultParams, + "callback": p + }); + + } + case 0: { + return id({ ...defaultParams }); + } + + } + + + } break; + + } + +} + diff --git a/deno_dist/lib/Evt.ts b/deno_dist/lib/Evt.ts new file mode 100644 index 00000000..9804a028 --- /dev/null +++ b/deno_dist/lib/Evt.ts @@ -0,0 +1,1060 @@ +import type { LightMap } from "../tools/minimal-polyfills/LightMap.ts"; +import { importProxy } from "./importProxy.ts"; +import { create } from "./Evt.create.ts"; +import { getCtxFactory } from "./Evt.getCtx.ts"; +import { factorize } from "./Evt.factorize.ts"; +import { merge } from "./Evt.merge.ts"; +import { from } from "./Evt.from.ts"; +import { asPostable } from "./Evt.asPostable.ts"; +import { asyncPipe } from "./Evt.asyncPipe.ts"; +import { asNonPostable } from "./Evt.asNonPostable.ts"; +import { parsePropsFromArgs, matchAll } from "./Evt.parsePropsFromArgs.ts"; +import { newCtx } from "./Evt.newCtx.ts"; +import { LazyEvt } from "./LazyEvt.ts"; +import * as runExclusive from "https://deno.land/x/run_exclusive@v2.2.19/mod.ts"; +import { overwriteReadonlyProp } from "https://deno.land/x/tsafe@v1.6.6/lab/overwriteReadonlyProp.ts"; +import { typeGuard } from "https://deno.land/x/tsafe@v1.6.6/typeGuard.ts"; +import { Deferred } from "../tools/Deferred.ts"; +import { loosenType } from "./Evt.loosenType.ts"; +import { safeClearTimeout, safeSetTimeout, Timer } from "../tools/safeSetTimeout.ts"; +import { isPromiseLike } from "https://deno.land/x/tsafe@v1.6.6/isPromiseLike.ts"; +import { DetachedEvtError, TimeoutEvtError } from "./types/EvtError.ts"; +import * as nsCtxLike from "./types/interfaces/CtxLike.ts"; +import type { Handler, Operator, NonPostableEvt, StatefulEvt, NonPostableEvtLike, CtxLike } from "./types/index.ts"; +import { convertOperatorToStatelessFλ } from "./util/convertOperatorToStatelessFLambda.ts"; +import type { AsyncIterableEvt } from "./types/AsyncIterableEvt.ts"; + +const runSideEffect = (sideEffect: () => void) => sideEffect(); + +// NOTE: For compat with --no-check +// https://github.com/asos-craigmorten/opine/issues/97#issuecomment-751806014 +const { CtxLike: CtxLikeAsValue } = nsCtxLike; + +/** https://docs.evt.land/api/evt */ +export type Evt = import("./types/interfaces/Evt.ts").Evt; + + +class EvtImpl implements Evt { + + static readonly create = create; + + static readonly newCtx = newCtx; + + static readonly merge = merge; + + static readonly from = from; + + static readonly getCtx = getCtxFactory(); + + static readonly loosenType = loosenType; + + static readonly factorize = factorize; + + static readonly asPostable = asPostable; + + static readonly asyncPipe = asyncPipe; + + static readonly asNonPostable = asNonPostable; + + private static __defaultMaxHandlers = 25; + + static setDefaultMaxHandlers(n: number): void { + this.__defaultMaxHandlers = isFinite(n) ? n : 0; + } + + toStateful(p1: any, p2?: CtxLike): StatefulEvt { + + const isP1Ctx = CtxLikeAsValue.match(p1); + + const initialValue: any = isP1Ctx ? undefined : p1; + const ctx = p2 || (isP1Ctx ? p1 : undefined); + + const out = new importProxy.StatefulEvt(initialValue); + + const callback = (data: T) => out.post(data); + + if (!!ctx) { + this.attach(ctx, callback); + } else { + this.attach(callback); + } + + return out; + + } + + get evtAttach(): Evt> { + return this.lazyEvtAttach.evt; + } + + get evtDetach(): Evt> { + return this.lazyEvtDetach.evt; + } + + private readonly lazyEvtAttach = new LazyEvt>(); + private readonly lazyEvtDetach = new LazyEvt>(); + + + private __maxHandlers: undefined | number = undefined; + + setMaxHandlers(n: number): this { + this.__maxHandlers = isFinite(n) ? n : 0; + return this; + } + + readonly postCount: number = 0; + + private traceId: string | null = null; + private traceFormatter!: (data: T) => string; + private log!: Exclude["enableTrace"]>[0]["log"], false>; + + enableTrace( + params: { + id: string, + formatter?: (data: T) => string, + log?: ((message?: any, ...optionalParams: any[]) => void) | false + } + //NOTE: Not typeof console.log as we don't want to expose types from node + ): void { + + const { id, formatter, log } = params; + + this.traceId = id; + + this.traceFormatter = formatter || ( + data => { + try { + return JSON.stringify(data, null, 2); + } catch { + return `${data}`; + } + } + ); + + this.log = + log === undefined ? + ((...inputs) => console.log(...inputs)) : + log === false ? undefined : log + ; + + } + + disableTrace(): this { + this.traceId = null; + return this; + } + + private readonly handlers: Handler[] = []; + + private readonly handlerTriggers: LightMap< + Handler, + (opResult: readonly [any]) => PromiseLike | undefined + > = new Map(); + + + //NOTE: An async handler ( attached with waitFor ) is only eligible to handle a post if the post + //occurred after the handler was set. We don't want to waitFor event from the past. + //private readonly asyncHandlerChronologyMark = new WeakMap(); + private get asyncHandlerChronologyMark(): WeakMap< + Handler.PropsFromMethodName.Async, + number + > { + return ((this as any)["~internal"] ??= {})["asyncHandlerChronologyMark"] ??= new WeakMap(); + } + + //NOTE: There is an exception to the above rule, we want to allow async waitFor loop + //do so we have to handle the case where multiple event would be posted synchronously. + private get asyncHandlerChronologyExceptionRange(): WeakMap< + Handler.PropsFromMethodName.Async, + { lowerMark: number; upperMark: number; } + > { + return ((this as any)["~internal"] ??= {})["asyncHandlerChronologyExceptionRange"] ??= new WeakMap(); + } + + + private get invocableOpByOp(): WeakMap< + Operator, + Operator.fλ.Stateless + > { + return ((this as any)["~internal"] ??= {})["invocableOpByOp"] ??= new WeakMap(); + } + + getInvocableOp(op: Operator): Operator.fλ.Stateless { + + const invocableOp = this.invocableOpByOp.get(op); + + if (invocableOp === undefined) { + throw new Error([ + "Provided operator isn't the operator of any handler", + "currently attached to the Evt instance" + ].join(" ")); + } + + return invocableOp; + + } + + /* + NOTE: Used as Date.now() would be used to compare if an event is anterior + or posterior to an other. We don't use Date.now() because two call within + less than a ms will return the same value unlike this function. + */ + private __currentChronologyMark = 0; + private getChronologyMark() { + return this.__currentChronologyMark++; + } + + + private asyncHandlerCount: number = 0; + + private detachHandler( + handler: Handler, + wTimer: [Timer | undefined], + rejectPr: (error: DetachedEvtError) => void + ) { + + const index = this.handlers.indexOf(handler); + + if (index < 0) { + return false; + } + + if (typeGuard>>(handler, !!handler.ctx)) { + handler.ctx.zz__removeHandler(handler); + } + + + this.handlers.splice(index, 1); + + if (handler.async) { + this.asyncHandlerCount--; + } + + this.handlerTriggers.delete(handler); + + if (wTimer[0] !== undefined) { + + safeClearTimeout(wTimer[0]); + + rejectPr(new DetachedEvtError()); + + } + + this.lazyEvtDetach.post(handler); + + return true; + + } + + + private triggerHandler( + handler: Handler, + wTimer: [Timer | undefined], + resolvePr: ((transformedData: any) => void) | undefined, + opResult: readonly [U] //TODO: Or readonly [ any ] ?? + ): PromiseLike | undefined { + + const { callback, once } = handler; + + if (wTimer[0] !== undefined) { + safeClearTimeout(wTimer[0]); + wTimer[0] = undefined; + } + + if (once) { + handler.detach(); + } + + const [transformedData] = opResult; + + const prOrValue = callback?.call( + this, + transformedData + ); + + resolvePr?.(transformedData); + + return isPromiseLike(prOrValue) ? prOrValue : undefined; + + } + + private addHandler( + propsFromArgs: Handler.PropsFromArgs, + propsFromMethodName: Handler.PropsFromMethodName + ): Handler { + + this.invocableOpByOp.set( + propsFromArgs.op, + convertOperatorToStatelessFλ(propsFromArgs.op) + ); + + const d = new Deferred(); + + const wTimer: [Timer | undefined] = [undefined]; + + const handler: Handler = { + ...propsFromArgs, + ...propsFromMethodName, + "detach": () => this.detachHandler(handler, wTimer, d.reject), + "promise": d.pr + }; + + if (typeof handler.timeout === "number") { + + wTimer[0] = safeSetTimeout(() => { + + wTimer[0] = undefined; + + handler.detach(); + + d.reject(new TimeoutEvtError(handler.timeout!)); + + }, handler.timeout); + + } + + const handlerTrigger: (opResult: readonly [U]) => PromiseLike | undefined + = opResult => this.triggerHandler( + handler, + wTimer, + d.isPending ? d.resolve : undefined, + opResult + ); + + this.handlerTriggers.set( + handler, + handlerTrigger + ); + + if (handler.async) { + + this.asyncHandlerChronologyMark.set( + handler, + this.getChronologyMark() + ); + + } + + if (handler.prepend) { + + let i: number; + + for (i = 0; i < this.handlers.length; i++) { + + if (this.handlers[i].extract) { + continue; + } + + break; + + } + + this.handlers.splice(i, 0, handler); + + } else { + + this.handlers.push(handler); + + } + + if (handler.async) { + this.asyncHandlerCount++; + } + + this.checkForPotentialMemoryLeak(); + + if (typeGuard>>(handler, !!handler.ctx)) { + handler.ctx.zz__addHandler(handler, this); + } + + onAddHandlerByEvt.get(this)?.(handler, handlerTrigger); + + //NOTE: Can happen for example if this is a StatefulEvt + //and the handler is "once" and the matcher match the state + //We don't want to post an attach if the handler is already detached. + if (this.handlerTriggers.has(handler)) { + + this.lazyEvtAttach.post(handler); + + } + + return handler; + + } + + + + private checkForPotentialMemoryLeak(): void { + + const maxHandlers = this.__maxHandlers !== undefined ? + this.__maxHandlers : + EvtImpl.__defaultMaxHandlers + ; + + + if ( + maxHandlers === 0 || + this.handlers.length % (maxHandlers + 1) !== 0) { + return; + } + + let message = [ + `MaxHandlersExceededWarning: Possible Evt memory leak detected.`, + `${this.handlers.length} handlers attached${this.traceId ? ` to "${this.traceId}"` : ""}.\n`, + `Use Evt.prototype.setMaxHandlers(n) to increase limit on a specific Evt.\n`, + `Use Evt.setDefaultMaxHandlers(n) to change the default limit currently set to ${EvtImpl.__defaultMaxHandlers}.\n`, + ].join(""); + + const map = new Map(); + + this.getHandlers() + .map(({ ctx, async, once, prepend, extract, op, callback }) => ({ + "hasCtx": !!ctx, + once, + prepend, + extract, + "isWaitFor": async, + ...(op === matchAll ? {} : { "op": op.toString() }), + ...(!callback ? {} : { "callback": callback.toString() }) + })) + .map(obj => + "{\n" + Object.keys(obj) + .map(key => ` ${key}: ${(obj as any)[key]}`) + .join(",\n") + "\n}" + ) + .forEach(str => map.set(str, (map.has(str) ? map.get(str)! : 0) + 1)) + ; + + message += "\n" + Array.from(map.keys()) + .map(str => `${map.get(str)} handler${map.get(str) === 1 ? "" : "s"} like:\n${str}`) + .join("\n") + "\n"; + + if (this.traceId === null) { + + message += "\n" + [ + `To validate the identify of the Evt instance that is triggering this warning you can call`, + `Evt.prototype.enableTrace({ "id": "My evt id", "log": false }) on the Evt that you suspect.\n` + ].join(" "); + + } + + try { + console.warn(message); + } catch { + } + + } + + isHandledByOp(op: Operator, data: T): boolean { + + let hasSideEffect = false; + + let invocableOp: Operator.fλ.Stateless; + + try { + + invocableOp = this.getInvocableOp(op); + + } catch { + + return false; + + } + + const opResult = invocableOp( + data, + () => hasSideEffect = true + ); + + return opResult !== null || hasSideEffect; + + } + + + private trace(data: T) { + + if (this.traceId === null) { + return; + } + + let message = `(${this.traceId}) `; + + const isExtracted = !!this.handlers.find( + ({ extract, op }) => ( + extract && + this.isHandledByOp(op, data) + ) + ); + + if (isExtracted) { + + message += "extracted "; + + } else { + + const handlerCount = this.handlers + .filter( + ({ extract, op }) => !extract && + this.isHandledByOp(op, data) + ) + .length; + + message += `${handlerCount} handler${(handlerCount > 1) ? "s" : ""}, `; + + } + + this.log?.(message + this.traceFormatter(data)); + + } + + /** Return [ isExtracted, prAllHandlerCallbacksResolved ] */ + private postSync(data: T): readonly [boolean, Promise] { + + const prAllHandlerCallbacksResolved: PromiseLike[] = []; + + const getReturnValue = (isExtracted: boolean) => [ + isExtracted, + Promise.all(prAllHandlerCallbacksResolved).then(() => { }) + ] as const; + + + for (const handler of [...this.handlers]) { + + const { async, op, extract } = handler; + + if (async) { + continue; + } + + //NOTE: If detached while executing the operator + //we still want to trigger the handler. + const handlerTrigger = this.handlerTriggers.get(handler); + + const opResult = this.getInvocableOp(op)( + data, + runSideEffect + ); + + if (opResult === null) { + continue; + } + + //NOTE: Possible if detached while in the loop. + if (!handlerTrigger) { + continue; + } + + const prOrUndefined = handlerTrigger(opResult); + + if (prOrUndefined !== undefined) { + prAllHandlerCallbacksResolved.push(prOrUndefined); + } + + if (extract) { + return getReturnValue(true); + } + + } + + return getReturnValue(false); + + } + + private postAsyncFactory() { + return runExclusive.buildMethodCb( + (data: T, postChronologyMark: number, releaseLock?) => { + + if (this.asyncHandlerCount === 0) { + releaseLock(); + return; + } + + const promises: Promise[] = []; + + let chronologyMarkStartResolveTick: number; + + //NOTE: Must be before handlerTrigger call. + Promise.resolve().then( + () => chronologyMarkStartResolveTick = this.getChronologyMark() + ); + + + for (const handler of [...this.handlers]) { + + if (!handler.async) { + continue; + } + + const opResult = this.getInvocableOp(handler.op)( + data, + runSideEffect + ); + + if (opResult === null) { + continue; + } + + const handlerTrigger = this.handlerTriggers.get(handler); + + if (!handlerTrigger) { + continue; + } + + const shouldCallHandlerTrigger = (() => { + + const handlerMark = this.asyncHandlerChronologyMark.get(handler)!; + + if (postChronologyMark > handlerMark) { + return true; + } + + const exceptionRange = this.asyncHandlerChronologyExceptionRange.get(handler); + + return ( + exceptionRange !== undefined && + exceptionRange.lowerMark < postChronologyMark && + postChronologyMark < exceptionRange.upperMark && + handlerMark > exceptionRange.upperMark + ); + + })(); + + if (!shouldCallHandlerTrigger) { + continue; + } + + promises.push( + new Promise( + resolve => handler.promise + .then(() => resolve()) + .catch(() => resolve()) + ) + ); + + handlerTrigger(opResult); + + + } + + if (promises.length === 0) { + releaseLock(); + return; + } + + const handlersDump = [...this.handlers]; + + Promise.all(promises).then(() => { + + for (const handler of this.handlers) { + + if (!handler.async) { + continue; + } + + if (handlersDump.indexOf(handler) >= 0) { + continue; + } + + this.asyncHandlerChronologyExceptionRange.set( + handler, + { + "lowerMark": postChronologyMark, + "upperMark": chronologyMarkStartResolveTick + } + ); + + } + + releaseLock(); + + }); + + } + ); + } + + declare private postAsync: ( + ( + data: T, + postChronologyMark: number + ) => void + ) | undefined; + + private static readonly propsFormMethodNames: Record< + "waitFor" | "attach" | "attachExtract" | "attachPrepend" | "attachOnce" | + "attachOncePrepend" | "attachOnceExtract" + , + Handler.PropsFromMethodName + > = { + "waitFor": { "async": true, "extract": false, "once": true, "prepend": false }, + "attach": { "async": false, "extract": false, "once": false, "prepend": false }, + "attachExtract": { "async": false, "extract": true, "once": false, "prepend": true }, + "attachPrepend": { "async": false, "extract": false, "once": false, "prepend": true }, + "attachOnce": { "async": false, "extract": false, "once": true, "prepend": false }, + "attachOncePrepend": { "async": false, "extract": false, "once": true, "prepend": true }, + "attachOnceExtract": { "async": false, "extract": true, "once": true, "prepend": true } + }; + + isHandled(data: T): boolean { + return !!this.getHandlers() + .find(({ op }) => this.isHandledByOp(op, data)) + ; + } + + getHandlers(): Handler[] { + return [...this.handlers]; + } + + detach(ctx?: CtxLike): Handler[] { + + const detachedHandlers: Handler[] = []; + + for (const handler of this.getHandlers()) { + + if (ctx !== undefined && handler.ctx !== ctx) { + continue; + } + + const wasStillAttached = handler.detach(); + + //NOTE: It should not be possible. + if (!wasStillAttached) { + continue; + } + + detachedHandlers.push(handler); + + } + + return detachedHandlers; + + } + + pipe(...args: any[]): Evt { + + const evtDelegate = new EvtImpl(); + + this.addHandler( + { + ...parsePropsFromArgs(args, "pipe"), + "callback": (transformedData: any) => evtDelegate.post(transformedData) + }, + EvtImpl.propsFormMethodNames.attach + ); + + return evtDelegate; + + } + + waitFor(...args: any[]): Promise { + return this.addHandler( + parsePropsFromArgs(args, "waitFor"), + EvtImpl.propsFormMethodNames.waitFor + ).promise; + } + + [Symbol.asyncIterator]() { + return this.iter()[Symbol.asyncIterator](); + } + + iter(...args: any[]): AsyncIterableEvt { + + const props = parsePropsFromArgs(args, "waitFor"); + + const ctx = (props.ctx ?? newCtx()) as ReturnType; + + const self = this; + + return { + ctx, + [Symbol.asyncIterator]() { + + const previousDonePostCount = ctx.evtDoneOrAborted.postCount; + + const timerWrap = (() => { + + const { timeout } = props; + + if (timeout === undefined) { + return undefined; + } + + const setTimeoutCallback = () => { + const error = new TimeoutEvtError(timeout); + ctx.abort(error); + }; + + const timer = setTimeout(setTimeoutCallback, timeout); + + return { timeout, setTimeoutCallback, timer }; + + })(); + + const evtProxy = self + .pipe(ctx, props.op) + .pipe((data, registerSideEffect) => { + + if (timerWrap !== undefined) { + + registerSideEffect(() => { + + clearTimeout(timerWrap.timer); + + timerWrap.timer = setTimeout(timerWrap.setTimeoutCallback, timerWrap.timeout); + }); + + } + + return [data]; + }); + + const events: [T][] = []; + + evtProxy.attach(event => events.push([event])); + + if (timerWrap !== undefined) { + + const { timer } = timerWrap; + + ctx.evtDoneOrAborted.attachOnce( + event => event.type === "DONE", + () => clearTimeout(timer) + ); + + } + + return { + async next() { + + let eventWrap = events.shift(); + + if (eventWrap === undefined) { + + const dEventWrap = new Deferred<[T] | undefined>(); + + if (previousDonePostCount < ctx.evtDoneOrAborted.postCount) { + return { "done": true }; + } + + const ctx2 = newCtx(); + + ctx.evtDoneOrAborted.attachOnce( + ctx2, + () => dEventWrap.resolve(undefined) + ); + + evtProxy.attachOnceExtract(ctx2, event => { + ctx2.done(); + dEventWrap.resolve([event]) + }); + + eventWrap = await dEventWrap.pr; + + if (eventWrap === undefined) { + return { "done": true }; + } + + } + + const out = { "done": false, "value": eventWrap[0] } as any; + + return out; + + }, + return() { + + self.detach(ctx); + + return { "done": true } as any; + }, + }; + } + + }; + + + } + + + + + $attach(...args: any[]) { + return this.attach(...args); + } + + attach(...args: any[]) { + return this.__attachX(args, "attach"); + } + + $attachOnce(...args: any[]) { + return this.attachOnce(...args); + } + + attachOnce(...args: any[]) { + return this.__attachX(args, "attachOnce"); + } + + $attachExtract(...args: any[]) { + return this.attachExtract(...args); + } + + attachExtract(...args: any[]) { + return this.__attachX(args, "attachExtract"); + } + + $attachPrepend(...args: any[]) { + return (this.attachPrepend as any)(...args); + } + + attachPrepend(...args: any[]) { + return this.__attachX(args, "attachPrepend"); + } + + $attachOncePrepend(...args: any[]) { + return this.attachOncePrepend(...args); + } + + attachOncePrepend(...args: any[]) { + return this.__attachX(args, "attachOncePrepend"); + } + + $attachOnceExtract(...args: any[]) { + return this.attachOnceExtract(...args); + } + + attachOnceExtract(...args: any[]) { + return this.__attachX(args, "attachOnceExtract"); + } + + private __attachX( + args: any[], + methodName: keyof typeof EvtImpl.propsFormMethodNames + ): any { + + const propsFromArgs = parsePropsFromArgs(args, "attach*"); + + const handler = this.addHandler( + propsFromArgs, + EvtImpl.propsFormMethodNames[methodName] + ); + + return propsFromArgs.timeout === undefined ? + this : + handler.promise + ; + + } + + postAsyncOnceHandled(data: T): number | Promise { + + if (this.isHandled(data)) { + return this.post(data); + } + + const d = new Deferred(); + + this.evtAttach.attachOnce( + ({ op }) => this.isHandledByOp(op, data), + () => Promise.resolve().then(() => d.resolve(this.post(data))) + ); + + return d.pr; + + } + + private postOrPostAndWait(data: T, wait: false): number; + private postOrPostAndWait(data: T, wait: true): Promise; + private postOrPostAndWait(data: T, wait: boolean): number | Promise { + + this.trace(data); + + overwriteReadonlyProp(this, "postCount", this.postCount + 1); + + //NOTE: Must be before postSync. + const postChronologyMark = this.getChronologyMark(); + + const [isExtracted, prAllHandlerCallbacksResolved] = this.postSync(data); + + const getReturnValue = wait ? + () => prAllHandlerCallbacksResolved : + () => this.postCount; + + if (isExtracted) { + return getReturnValue(); + } + + if (this.postAsync === undefined) { + + if (this.asyncHandlerCount === 0) { + return getReturnValue(); + } + + this.postAsync = this.postAsyncFactory(); + + } + + this.postAsync(data, postChronologyMark); + + return getReturnValue(); + + } + + post(data: T) { + return this.postOrPostAndWait(data, false); + } + + postAndWait(data: T) { + return this.postOrPostAndWait(data, true); + } + +} + +/** + * Can be seen as a protected method that can be + * optionally be implemented by class extending Evt. + * + * Should only be accessible from within the module. + * Basically it is for allowing StatefulEvt to execute + * the callback on attach. + */ +export const onAddHandlerByEvt = new WeakMap< + NonPostableEvtLike, + ( + handler: Handler, + handlerTrigger: (opResult: readonly [any]) => PromiseLike | undefined + ) => void>(); + + +export const Evt: { + new (): Evt; + readonly prototype: Evt; + + readonly create: typeof create; + + readonly newCtx: typeof newCtx; + + readonly merge: typeof merge; + + readonly from: typeof from; + + readonly getCtx: ReturnType; + + readonly loosenType: typeof loosenType; + + readonly factorize: typeof factorize; + + readonly asPostable: typeof asPostable; + + readonly asyncPipe: typeof asyncPipe; + + readonly asNonPostable: typeof asNonPostable; + + /** https://docs.evt.land/api/evt/setdefaultmaxhandlers */ + setDefaultMaxHandlers(n: number): void; + +} = EvtImpl; + +try { overwriteReadonlyProp(Evt as any, "name", "Evt"); } catch { } + +importProxy.Evt = Evt; + diff --git a/deno_dist/lib/LazyEvt.ts b/deno_dist/lib/LazyEvt.ts new file mode 100644 index 00000000..8d0e54c3 --- /dev/null +++ b/deno_dist/lib/LazyEvt.ts @@ -0,0 +1,44 @@ +import { overwriteReadonlyProp } from "https://deno.land/x/tsafe@v1.6.6/lab/overwriteReadonlyProp.ts"; +import { importProxy } from "./importProxy.ts"; +import type { Evt } from "./types/index.ts"; + +export class LazyEvt { + + private initialPostCount = 0; + + get evt(): Evt { + + if (this.__evt === undefined) { + this.__evt = new importProxy.Evt(); + overwriteReadonlyProp(this.__evt, "postCount", this.initialPostCount); + } + + return this.__evt; + + } + + declare private __evt: Evt; + + private __post(data: T, doWait: false): number; + private __post(data: T, doWait: true): Promise; + private __post(data: T, doWait: boolean): number | Promise { + + if (this.__evt === undefined) { + + return ++this.initialPostCount; + + } + + return this.__evt[doWait ? "postAndWait" : "post"](data); + + } + + post(data: T) { + return this.__post(data, false); + } + + postAndWait(data: T) { + return this.__post(data, true); + } + +} diff --git a/deno_dist/lib/LazyStatefulEvt.ts b/deno_dist/lib/LazyStatefulEvt.ts new file mode 100644 index 00000000..bb09344c --- /dev/null +++ b/deno_dist/lib/LazyStatefulEvt.ts @@ -0,0 +1,54 @@ +import { overwriteReadonlyProp } from "https://deno.land/x/tsafe@v1.6.6/lab/overwriteReadonlyProp.ts"; +import { importProxy } from "./importProxy.ts"; +import type { StatefulEvt } from "./types/index.ts" +export class LazyStatefulEvt { + + private initialPostCount = 0; + private initialState: T; + + get evt(): StatefulEvt { + + if (this.__evt === undefined) { + this.__evt = new importProxy.StatefulEvt(this.initialState); + //NOTE: For avoid keeping strong reference + this.initialState = null as any; + overwriteReadonlyProp(this.__evt, "postCount", this.initialPostCount); + } + + return this.__evt; + + } + declare private __evt: StatefulEvt; + + constructor(initialState: T) { + this.initialState = initialState; + } + + + private __post(data: T, doWait: false): number; + private __post(data: T, doWait: true): Promise; + private __post(data: T, doWait: boolean): number | Promise { + + if (this.__evt === undefined) { + + this.initialState = data; + + return ++this.initialPostCount; + + + } + + return this.__evt[doWait ? "postAndWait" : "post"](data); + + } + + post(data: T) { + return this.__post(data, false); + } + + postAndWait(data: T) { + return this.__post(data, true); + } + + +} \ No newline at end of file diff --git a/deno_dist/lib/StatefulEvt.ts b/deno_dist/lib/StatefulEvt.ts new file mode 100644 index 00000000..c148ace1 --- /dev/null +++ b/deno_dist/lib/StatefulEvt.ts @@ -0,0 +1,172 @@ +import { LazyEvt } from "./LazyEvt.ts"; +import { LazyStatefulEvt } from "./LazyStatefulEvt.ts"; +import { importProxy } from "./importProxy.ts"; +import { Evt, onAddHandlerByEvt } from "./Evt.ts"; +import type { CtxLike, StateDiff, NonPostableEvt, StatefulReadonlyEvt } from "./types/index.ts"; +import { assert } from "https://deno.land/x/tsafe@v1.6.6/assert.ts"; +import { id } from "https://deno.land/x/tsafe@v1.6.6/id.ts"; + +/** https://docs.evt.land/api/statefulevt */ +export type StatefulEvt = import("./types/interfaces/index.ts").StatefulEvt; + +const runSideEffect = (sideEffect: ()=> void) => sideEffect(); + +class StatefulEvtImpl extends Evt implements StatefulEvt { + + __state: T; + get state(): T { return this.__state; } + set state(value: T) { + if (this.state === value) return; + this.post(value); + } + + constructor(initialState: T) { + super(); + this.__state = initialState; + this.lazyEvtChange = new LazyStatefulEvt(this.__state); + + onAddHandlerByEvt.set( + this, + (handler, handlerTrigger) => { + + if( handler.extract ){ + return; + } + + let sideEffect= id<(()=> void) | undefined>(undefined); + + + const opResult = this.getInvocableOp(handler.op)( + this.__state, + this.setOpResultForPipe !== undefined ? (sideEffect_=>sideEffect =sideEffect_) : runSideEffect + ); + + if( this.setOpResultForPipe !== undefined ){ + this.setOpResultForPipe(opResult); + if( sideEffect !== undefined ){ + sideEffect(); + } + } + + if (!opResult) { + return; + } + + handlerTrigger(opResult); + + } + ); + } + + private readonly lazyEvtDiff = new LazyEvt>(); + get evtDiff(): NonPostableEvt> { return this.lazyEvtDiff.evt; } + + private readonly lazyEvtChange: LazyStatefulEvt; + get evtChange(): StatefulReadonlyEvt { return this.lazyEvtChange.evt; } + + private readonly lazyEvtChangeDiff = new LazyEvt>(); + get evtChangeDiff(): NonPostableEvt> { return this.lazyEvtChangeDiff.evt; } + + post(data: T): number { + return this.__post(data, false, false); + } + + postForceChange(wData?: readonly [T]): number { + return this.__post(!!wData ? wData[0] : this.state, true, false); + } + + postAndWait(data: T) { + return this.__post(data, false, true); + } + + private __post(data: T, forceChange: boolean, doWait: false): number; + private __post(data: T, forceChange: boolean, doWait: true): Promise; + private __post(data: T, forceChange: boolean, doWait: boolean): number | Promise { + + const prevState = this.state; + + this.__state = data; + + const diff = { prevState, "newState": this.state }; + + const postVariantName = doWait ? "postAndWait" : "post"; + + const prs: Promise[] = []; + + const r1 = this.lazyEvtDiff[postVariantName](diff); + + if (doWait) { + prs.push(r1 as any); + } + + if (forceChange || !Object.is(prevState, this.state)) { + const r2 = this.lazyEvtChange[postVariantName](this.state); + const r3 = this.lazyEvtChangeDiff[postVariantName](diff); + + if (doWait) { + prs.push(r2 as any, r3 as any); + } + + } + + const r4 = super[postVariantName](data); + + return doWait ? + (prs.push(r4 as any), Promise.all(prs).then(() => { })) : + r4; + + } + + private setOpResultForPipe: ((opResult: readonly [any] | null) => void) | undefined; + + pipe(...args: any[]): StatefulEvt { + + let opResult: readonly [any] | null | undefined = undefined; + + this.setOpResultForPipe = opResult_ => opResult = opResult_; + + const evt = super + .pipe(...(args as Parameters)) + ; + + assert(opResult !== undefined); + + this.setOpResultForPipe = undefined; + + if (!opResult) { + + throw new Error([ + "Cannot pipe StatefulEvt because the operator does not match", + "it's current state. You would end up with evt.state === undefined", + "Use evt.toStateless([ctx]).pipe(op).toStatic(initialState)", + "to be sure the StatefulEvt does not have an undefined state" + ].join(" ")); + + } + + return evt.toStateful(opResult[0]); + + } + + toStateless(ctx?: CtxLike): Evt { + + const onAddHandler= onAddHandlerByEvt.get(this)!; + + onAddHandlerByEvt.delete(this); + + const out= !!ctx ? super.pipe(ctx) : super.pipe(); + + onAddHandlerByEvt.set(this, onAddHandler); + + return out; + } + +} + +export const StatefulEvt: { + new (initialState: T): StatefulEvt; + readonly prototype: StatefulEvt; +} = StatefulEvtImpl; + +importProxy.StatefulEvt = StatefulEvt; + diff --git a/deno_dist/lib/importProxy.ts b/deno_dist/lib/importProxy.ts new file mode 100644 index 00000000..4ce5fbea --- /dev/null +++ b/deno_dist/lib/importProxy.ts @@ -0,0 +1,14 @@ + +import type { Ctx } from "./Ctx.ts"; +import type { Evt } from "./Evt.ts"; +import type { StatefulEvt } from "./StatefulEvt.ts"; + +/** Manually handling circular import so React Native does not gives warning. */ +export const importProxy: { + Ctx: typeof Ctx; + Evt: typeof Evt; + StatefulEvt: typeof StatefulEvt; +} = {} as any; + + + diff --git a/deno_dist/lib/index.ts b/deno_dist/lib/index.ts new file mode 100644 index 00000000..231539f5 --- /dev/null +++ b/deno_dist/lib/index.ts @@ -0,0 +1,15 @@ + +export * from "./types/index.ts"; +export * from "./util/index.ts"; + +export { Ctx } from "./Ctx.ts"; +export { Evt } from "./Evt.ts"; +export { StatefulEvt } from "./StatefulEvt.ts"; + +export { to } from "../operators/to.ts"; +// TODO: Those operators have no business being exported in the +// main entry point of the library. +export { throttleTime } from "../operators/throttleTime.ts"; +export { nonNullable } from "../operators/nonNullable.ts"; +export { distinct } from "../operators/distinct.ts"; + diff --git a/deno_dist/lib/types/AsyncIterableEvt.ts b/deno_dist/lib/types/AsyncIterableEvt.ts new file mode 100644 index 00000000..61fda9a2 --- /dev/null +++ b/deno_dist/lib/types/AsyncIterableEvt.ts @@ -0,0 +1,5 @@ +import type { Ctx } from "./interfaces/Ctx.ts"; + +export type AsyncIterableEvt = AsyncIterable & { + ctx: Ctx; +}; \ No newline at end of file diff --git a/deno_dist/lib/types/EventTargetLike.ts b/deno_dist/lib/types/EventTargetLike.ts new file mode 100644 index 00000000..f32e23e1 --- /dev/null +++ b/deno_dist/lib/types/EventTargetLike.ts @@ -0,0 +1,141 @@ + +import { typeGuard } from "https://deno.land/x/tsafe@v1.6.6/typeGuard.ts"; + +export type EventTargetLike = + EventTargetLike.HasEventTargetAddRemove | + EventTargetLike.NodeStyleEventEmitter | + EventTargetLike.JQueryStyleEventEmitter | + EventTargetLike.RxJSSubject + ; + +export namespace EventTargetLike { + + export type HTMLElement = HasEventTargetAddRemove & { + innerText: string; + }; + + export type Window = HasEventTargetAddRemove & { + document: EventTargetLike.Document; + }; + + export type Document = HasEventTargetAddRemove & { + URL: string; + }; + + export type RxJSSubject = { + subscribe: (next: (data: T) => void) => RxJSSubject.Subscription; + }; + + export namespace RxJSSubject { + + export type Subscription = { + unsubscribe(): void; + }; + + export function match(eventTarget: EventTargetLike): eventTarget is RxJSSubject { + return ( + typeGuard>(eventTarget, true) && + eventTarget instanceof Object && + typeof eventTarget.subscribe === "function" + ); + } + + + } + + + export type NodeStyleEventEmitter = + NodeStyleEventEmitter.Compat | + NodeStyleEventEmitter.Regular + ; + + export namespace NodeStyleEventEmitter { + + export interface Regular { + addListener: (eventName: string | symbol, handler: NodeEventHandler) => this; + removeListener: (eventName: string | symbol, handler: NodeEventHandler) => this; + }; + + export interface Compat { + addListener: (eventName: string, handler: NodeEventHandler) => void | {}; + removeListener: (eventName: string, handler: NodeEventHandler) => void | {}; + } + + export declare type NodeEventHandler = (...args: any[]) => void; + + export function match(eventTarget: EventTargetLike): eventTarget is NodeStyleEventEmitter { + return ( + typeGuard(eventTarget, true) && + eventTarget instanceof Object && + typeof eventTarget.addListener === "function" && + typeof eventTarget.removeListener === "function" + ); + } + + } + + export interface JQueryStyleEventEmitter { + on: (eventName: string, handler: Function) => void; + off: (eventName: string, handler: Function) => void; + } + + export namespace JQueryStyleEventEmitter { + + export function match(eventTarget: EventTargetLike): eventTarget is JQueryStyleEventEmitter { + return ( + typeGuard(eventTarget, true) && + eventTarget instanceof Object && + typeof eventTarget.on === "function" && + typeof eventTarget.off === "function" + ); + } + + } + + export interface HasEventTargetAddRemove { + addEventListener(type: string, listener: ((evt: E) => void) | null, options?: boolean | HasEventTargetAddRemove.Options): void; + removeEventListener(type: string, listener?: ((evt: E) => void) | null, options?: HasEventTargetAddRemove.Options | boolean): void; + } + + export namespace HasEventTargetAddRemove { + + export interface Options { + capture?: boolean; + passive?: boolean; + once?: boolean; + } + + export function match(eventTarget: EventTargetLike): eventTarget is HasEventTargetAddRemove { + return ( + typeGuard>(eventTarget, true) && + eventTarget instanceof Object && + typeof eventTarget.addEventListener === "function" && + typeof eventTarget.removeEventListener === "function" + ); + } + + } + + + /* Return true if o can be a EventTargetLike */ + export function canBe(o: any): boolean { + + try{ + + return ( + HasEventTargetAddRemove.match(o) || + NodeStyleEventEmitter.match(o) || + JQueryStyleEventEmitter.match(o) || + RxJSSubject.match(o) + ); + + }catch{ + + return false; + + } + + } + + +} diff --git a/deno_dist/lib/types/EvtError.ts b/deno_dist/lib/types/EvtError.ts new file mode 100644 index 00000000..633ff450 --- /dev/null +++ b/deno_dist/lib/types/EvtError.ts @@ -0,0 +1,18 @@ + + +export class TimeoutEvtError extends Error { + constructor(public readonly timeout: number) { + super(`Evt timeout after ${timeout}ms`); + Object.setPrototypeOf(this, new.target.prototype); + } +} + +export class DetachedEvtError extends Error { + constructor() { + super(`Evt handler detached`); + Object.setPrototypeOf(this, new.target.prototype); + } +} + + + diff --git a/deno_dist/lib/types/Handler.ts b/deno_dist/lib/types/Handler.ts new file mode 100644 index 00000000..a657b5b4 --- /dev/null +++ b/deno_dist/lib/types/Handler.ts @@ -0,0 +1,59 @@ +import type { Operator } from "./Operator.ts"; +import type { CtxLike, NonPostableEvtLike } from "../types/interfaces/index.ts"; + +/** https://docs.evt.land/api/handler */ +export type Handler | undefined = CtxLike | undefined> = + Handler.PropsFromArgs & + Handler.PropsFromMethodName & Readonly<{ + detach(): boolean; + promise: Promise; + }> + ; + +export namespace Handler { + + /** Handlers params that come from the arguments passed to the method invoked */ + export type PropsFromArgs | undefined = CtxLike | undefined> = { + ctx: CtxProp; + timeout: number | undefined; + op: Operator; + callback: ((transformedData: U) => void) | undefined; + }; + + /** + * Handlers params that are implicitly specified by the method used: + * attachOnce => once + * attachOncePrepend => once + prepend + * waitFor => once + async + * ... + */ + export type PropsFromMethodName = PropsFromMethodName.Sync | PropsFromMethodName.Async; + + export namespace PropsFromMethodName { + + type Common = Readonly<{ + prepend: true; + extract: true; + } | { + prepend: boolean; + extract: false; + }>; + + export type Sync = Common & Readonly<{ + async: false; + once: boolean; + }>; + + export type Async = Common & Readonly<{ + async: true; + once: true; + }>; + + } + + export type WithEvt = { + handler: Handler>; + evt: NonPostableEvtLike; + }; + +} \ No newline at end of file diff --git a/deno_dist/lib/types/Observer.ts b/deno_dist/lib/types/Observer.ts new file mode 100644 index 00000000..05ed6485 --- /dev/null +++ b/deno_dist/lib/types/Observer.ts @@ -0,0 +1,15 @@ + + +export type Observer = { + observe(target: Target): void; + disconnect(): void; +}; + +export type ObserverCallback = (entries: Entry[]) => void; + +export type ObserverConstructor = { + prototype: Observer; + new(callback: ObserverCallback): Observer; +}; + + diff --git a/deno_dist/lib/types/Operator.ts b/deno_dist/lib/types/Operator.ts new file mode 100644 index 00000000..7f5079eb --- /dev/null +++ b/deno_dist/lib/types/Operator.ts @@ -0,0 +1,33 @@ + +/** https://docs.evt.land/api/operator */ +export type Operator = + Operator.fλ | + ((data: U) => boolean) | //Filter + (U extends T ? (data: T) => data is U : never) //Type guard + ; + +export namespace Operator { + + export type fλ = + fλ.Stateless | + fλ.Stateful + ; + + export namespace fλ { + + export type Stateless = (data: T, registerSideEffect: (sideEffect: () => void) => void) => readonly [U] | null; + + export type Stateful = [ + (data: T, prev: U, registerSideEffect: (sideEffect: () => void)=> void) => readonly [U] | null, + U //Seed + ]; + + } + + export type Stateless = + fλ.Stateless | + ((data: U) => boolean) | + (U extends T ? (data: T) => data is U : never) + ; + +} diff --git a/deno_dist/lib/types/helper/EvtLikeToEvt.ts b/deno_dist/lib/types/helper/EvtLikeToEvt.ts new file mode 100644 index 00000000..1e8b58bd --- /dev/null +++ b/deno_dist/lib/types/helper/EvtLikeToEvt.ts @@ -0,0 +1,6 @@ + +import type { NonPostableEvtLike } from "../interfaces/index.ts"; +import type { SwapEvtType } from "./SwapEvtType.ts"; +import type { UnpackEvt } from "./UnpackEvt.ts"; + +export type EvtLikeToEvt> = SwapEvtType>; diff --git a/deno_dist/lib/types/helper/FactorizeEvt.ts b/deno_dist/lib/types/helper/FactorizeEvt.ts new file mode 100644 index 00000000..4bc4f5c5 --- /dev/null +++ b/deno_dist/lib/types/helper/FactorizeEvt.ts @@ -0,0 +1,8 @@ + +import type { NonPostableEvtLike } from "../interfaces/NonPostableEvtLike.ts"; +import type { SwapEvtType } from "./SwapEvtType.ts"; +import type { UnpackEvt } from "./UnpackEvt.ts"; + +/** https://docs.evt.land/api/helpertypes#swapevttype-less-than-e-t-greater-than */ +export type FactorizeEvt> = SwapEvtType>; + diff --git a/deno_dist/lib/types/helper/SwapEvtType.ts b/deno_dist/lib/types/helper/SwapEvtType.ts new file mode 100644 index 00000000..1ed77063 --- /dev/null +++ b/deno_dist/lib/types/helper/SwapEvtType.ts @@ -0,0 +1,14 @@ +import type { + StatefulEvtLike, StatefulEvt, + StatefulReadonlyEvtLike, StatefulReadonlyEvt, + EvtLike, Evt, + NonPostableEvtLike, NonPostableEvt +} from "../interfaces/index.ts"; + +/** https://docs.evt.land/api/helpertypes#swapevttype-less-than-e-t-greater-than */ +export type SwapEvtType, T> = + E extends StatefulEvtLike ? StatefulEvt : + E extends StatefulReadonlyEvtLike ? StatefulReadonlyEvt : + E extends EvtLike ? Evt : + NonPostableEvt + ; diff --git a/deno_dist/lib/types/helper/ToNonPostableEvt.ts b/deno_dist/lib/types/helper/ToNonPostableEvt.ts new file mode 100644 index 00000000..928f0eef --- /dev/null +++ b/deno_dist/lib/types/helper/ToNonPostableEvt.ts @@ -0,0 +1,19 @@ + +import type { StatefulReadonlyEvtLike, NonPostableEvtLike, NonPostableEvt, StatefulReadonlyEvt } from "../interfaces/index.ts"; + +type ToNonPostableEvtBase> = + E extends StatefulReadonlyEvtLike ? StatefulReadonlyEvt : + E extends NonPostableEvtLike ? NonPostableEvt : never + ; + +type ToNonPostableEvtRecord = { + [P in keyof R]: R[P] extends NonPostableEvt ? ToNonPostableEvtBase : R[P]; +}; + +/** https://docs.evt.land/api/helpertypes#tononpostableevt-less-than-e-greater-than */ +export type ToNonPostableEvt)> = + E extends NonPostableEvt ? ToNonPostableEvtBase : + ToNonPostableEvtRecord + ; + + diff --git a/deno_dist/lib/types/helper/ToPostableEvt.ts b/deno_dist/lib/types/helper/ToPostableEvt.ts new file mode 100644 index 00000000..c47fa6e0 --- /dev/null +++ b/deno_dist/lib/types/helper/ToPostableEvt.ts @@ -0,0 +1,24 @@ + +import type { + NonPostableEvtLike, + StatefulReadonlyEvtLike, + StatefulEvt, + Evt, +} from "../interfaces/index.ts"; + + +type ToPostableEvtBase> = + E extends StatefulReadonlyEvtLike ? StatefulEvt : + E extends NonPostableEvtLike ? Evt : never + ; + +type ToPostableEvtRecord = { + [P in keyof R]: R[P] extends NonPostableEvtLike ? ToPostableEvtBase : R[P]; +}; + +/** https://docs.evt.land/api/helpertypes#topostableevt-less-than-e-greater-than */ +export type ToPostableEvt)> = + E extends NonPostableEvtLike ? ToPostableEvtBase : + ToPostableEvtRecord + ; + diff --git a/deno_dist/lib/types/helper/UnpackCtx.ts b/deno_dist/lib/types/helper/UnpackCtx.ts new file mode 100644 index 00000000..2d3d4519 --- /dev/null +++ b/deno_dist/lib/types/helper/UnpackCtx.ts @@ -0,0 +1,11 @@ + + +export interface CtxLike { + done(result: Result): void; +} + +/** Analog to UnpackEvt Unpack the type argument of a Ctx */ +export type UnpackCtx | undefined | null> = + Ctx extends CtxLike ? U : never + ; + diff --git a/deno_dist/lib/types/helper/UnpackEvt.ts b/deno_dist/lib/types/helper/UnpackEvt.ts new file mode 100644 index 00000000..39151321 --- /dev/null +++ b/deno_dist/lib/types/helper/UnpackEvt.ts @@ -0,0 +1,18 @@ + +import type { NonPostableEvtLike } from "../interfaces/NonPostableEvtLike.ts"; + +type UnpackEvtBase> = T extends NonPostableEvtLike ? U : never; + +type UnpackEvtRecord = { + [P in keyof T]: T[P] extends NonPostableEvtLike ? UnpackEvtBase : T[P]; +}; + +type UnpackNonNullableEvt)> = + T extends NonPostableEvtLike ? UnpackEvtBase : + UnpackEvtRecord + ; + +/** https://docs.evt.land/api/helpertypes#unpackevt-less-than-e-greater-than */ +export type UnpackEvt | undefined | null)> = + UnpackNonNullableEvt> + diff --git a/deno_dist/lib/types/helper/index.ts b/deno_dist/lib/types/helper/index.ts new file mode 100644 index 00000000..cc427460 --- /dev/null +++ b/deno_dist/lib/types/helper/index.ts @@ -0,0 +1,8 @@ +export type { UnpackEvt } from "./UnpackEvt.ts"; +export type { FactorizeEvt } from "./FactorizeEvt.ts"; +export type { SwapEvtType } from "./SwapEvtType.ts"; +export type { ToPostableEvt } from "./ToPostableEvt.ts"; +export type { ToNonPostableEvt } from "./ToNonPostableEvt.ts"; +export type { UnpackCtx } from "./UnpackCtx.ts"; +export type { EvtLikeToEvt } from "./EvtLikeToEvt.ts"; + diff --git a/deno_dist/lib/types/index.ts b/deno_dist/lib/types/index.ts new file mode 100644 index 00000000..56ad3e87 --- /dev/null +++ b/deno_dist/lib/types/index.ts @@ -0,0 +1,11 @@ +export * from "./helper/index.ts"; +export * from "./interfaces/index.ts"; + +export type { Handler } from "./Handler.ts"; + +export * as dom from "./lib.dom.ts"; + +//NOTE: For support of --no-check, see: https://github.com/asos-craigmorten/opine/issues/97#issuecomment-751806014 +export * from "./EventTargetLike.ts"; +export * from "./EvtError.ts"; +export * from "./Operator.ts"; diff --git a/deno_dist/lib/types/interfaces/Ctx.ts b/deno_dist/lib/types/interfaces/Ctx.ts new file mode 100644 index 00000000..999e9462 --- /dev/null +++ b/deno_dist/lib/types/interfaces/Ctx.ts @@ -0,0 +1,104 @@ +import type { CtxLike } from "./CtxLike.ts"; +import type { Handler } from "../Handler.ts"; +import type { NonPostableEvtLike } from "./NonPostableEvtLike.ts"; +import type { Evt } from "./Evt.ts"; + +export type DoneOrAborted = DoneOrAborted.Done | DoneOrAborted.Aborted; +export namespace DoneOrAborted { + + type Common = { + handlers: Handler.WithEvt[]; + } + + export type Done = Common & { + type: "DONE"; + result: Result; + error?: undefined; + }; + + export type Aborted = Common & { + type: "ABORTED"; + error: Error; + result?: undefined; + }; + +} + + +/** https://docs.evt.land/api/ctx */ +export interface Ctx { + + /** https://docs.evt.land/api/ctx#ctx-evtdoneoraborted */ + readonly evtDoneOrAborted: Evt>; + + /** + * https://docs.evt.land/api/ctx#ctx-evtattach + * + * Posted every time a handler is bound to this context + * */ + readonly evtAttach: Evt>; + + /** + * https://docs.evt.land/api/ctx#ctx-evtdetach + * + * Posted every time a handler bound to this context is detached from it's Evt + * */ + readonly evtDetach: Evt>; + + /** + * If .done() of .abort() has been called, returns the result or error of the call. + **/ + readonly completionStatus: DoneOrAborted | undefined; + + /** + * https://docs.evt.land/api/ctx#ctx-waitfor-timeout + * + * Return a promise that resolve next time ctx.done(result) is invoked + * Reject if ctx.abort(error) is invoked. + * Optionally a timeout can be passed, if so the returned promise will reject + * with EvtError.Timeout if done(result) is not called within [timeout]ms. + * If the timeout is reached ctx.abort(timeoutError) will be invoked. + */ + waitFor(timeout?: number): Promise; + + + /** + * https://docs.evt.land/api/ctx#ctx-abort-error + * + * All the handler will be detached. + * evtDone will post [ error, undefined, handlers (detached) ] + * if getPrDone() was invoked the promise will reject with the error + */ + abort(error: Error): Handler.WithEvt[]; + + /** + * https://docs.evt.land/api/ctx#ctx-done-result + * + * Detach all handlers. + * evtDone will post [ null, result, handlers (detached) ] + * If getPrDone() was invoked the promise will result with result + */ + done(result: Result): Handler.WithEvt[]; + + + /** https://docs.evt.land/api/ctx#ctx-gethandlers */ + getHandlers(): Handler.WithEvt[]; + + /** + * Exposed to enable safe interoperability between mismatching EVT versions. + * Should be considered private + * */ + zz__addHandler( + handler: Handler>, + evt: NonPostableEvtLike + ): void; + + /** + * Exposed to enable safe interoperability between EVT versions. + * Should be considered private + * */ + zz__removeHandler( + handler: Handler>, + ): void; + +} diff --git a/deno_dist/lib/types/interfaces/CtxLike.ts b/deno_dist/lib/types/interfaces/CtxLike.ts new file mode 100644 index 00000000..db37774d --- /dev/null +++ b/deno_dist/lib/types/interfaces/CtxLike.ts @@ -0,0 +1,30 @@ + +import { typeGuard } from "https://deno.land/x/tsafe@v1.6.6/typeGuard.ts"; +import type { NonPostableEvtLike } from "./NonPostableEvtLike.ts"; +import type { Handler } from "../Handler.ts"; + +/** + * Minimal interface that an object must implement to be a valid context argument + * ( for interop between mismatching EVT versions ) + * */ +export interface CtxLike { + done(result: Result): void; + abort(error: Error): void; + zz__addHandler(handler: Handler>, evt: NonPostableEvtLike): void; + zz__removeHandler(handler: Handler>): void; +} + +export namespace CtxLike { + + export function match(o: any): o is CtxLike { + return ( + typeGuard(o, true) && + o instanceof Object && + typeof o.done === "function" && + typeof o.abort === "function" && + typeof o.zz__addHandler === "function" && + typeof o.zz__removeHandler === "function" + ); + } + +} diff --git a/deno_dist/lib/types/interfaces/Evt.ts b/deno_dist/lib/types/interfaces/Evt.ts new file mode 100644 index 00000000..d89c062e --- /dev/null +++ b/deno_dist/lib/types/interfaces/Evt.ts @@ -0,0 +1,5 @@ + +import type { Postable } from "./Postable.ts"; +import type { NonPostableEvt } from "./NonPostableEvt.ts"; + +export interface Evt extends Postable, NonPostableEvt { } \ No newline at end of file diff --git a/deno_dist/lib/types/interfaces/EvtLike.ts b/deno_dist/lib/types/interfaces/EvtLike.ts new file mode 100644 index 00000000..40082dd3 --- /dev/null +++ b/deno_dist/lib/types/interfaces/EvtLike.ts @@ -0,0 +1,6 @@ + +import type { NonPostableEvtLike } from "./NonPostableEvtLike.ts"; + +export interface EvtLike extends NonPostableEvtLike { + post(data: T): void; +}; \ No newline at end of file diff --git a/deno_dist/lib/types/interfaces/NonPostableEvt.ts b/deno_dist/lib/types/interfaces/NonPostableEvt.ts new file mode 100644 index 00000000..28de5a26 --- /dev/null +++ b/deno_dist/lib/types/interfaces/NonPostableEvt.ts @@ -0,0 +1,1886 @@ +import type { Operator } from "../Operator.ts"; +import type { StatefulEvt } from "./StatefulEvt.ts"; +import type { CtxLike } from "./CtxLike.ts"; +import type { Evt } from "./Evt.ts"; +import type { Handler } from "../Handler.ts"; +import type { AsyncIterableEvt } from "../AsyncIterableEvt.ts"; +export interface NonPostableEvt { + + /** https://docs.evt.land/api/statefulevt#converting-an-evt-into-a-statefulevt */ + toStateful(initialState: T, ctx?: CtxLike): StatefulEvt; + toStateful(ctx?: CtxLike): StatefulEvt; + + /** https://docs.evt.land/api/evt/evtattachdetach */ + readonly evtAttach: Evt>; + /** https://docs.evt.land/api/evt/evtattachdetach */ + readonly evtDetach: Evt>; + + /** https://docs.evt.land/api/evt/setmaxhandlers */ + setMaxHandlers(n: number): this; + + /** + * https://docs.evt.land/api/evt/post + * + * Number of times .post(data) have been called. + */ + readonly postCount: number; + + /** https://docs.evt.land/api/evt/enabletrace */ + enableTrace( + params: { + id: string, + formatter?: (data: T) => string, + log?: ((message?: any, ...optionalParams: any[]) => void) | false + } + //NOTE: Not typeof console.log as we don't want to expose types from node + ): void; + + /** https://docs.evt.land/api/evt/enabletrace */ + disableTrace(): this; + + /** + * TODO: Update doc, it replace: https://docs.evt.land/api/evt/getstatelessop + * Maybe this feature is too confusing to be documented... + * */ + getInvocableOp(op: Operator): Operator.fλ.Stateless; + + /** TODO: DOC !!! */ + isHandledByOp(op: Operator, data: T): boolean; + + /** + * https://docs.evt.land/api/evt/ishandled + * + * Test if posting a given event data will have an effect. + * + * Return true if: + * -There is at least one handler matching + * this event data ( at least one handler's callback function + * will be invoked if the data is posted. ) + * -Handlers could be will be detached + * if the event data is posted. + * + */ + isHandled(data: T): boolean; + + /** https://docs.evt.land/api/evt/gethandler */ + getHandlers(): Handler[]; + + /** + * https://docs.evt.land/api/evt/detach + * + * Detach every handlers of the Evt that are bound to the provided context + * */ + detach(ctx: CtxLike): Handler>[]; + /** + * https://docs.evt.land/api/evt/detach + * + * (unsafe) Detach every handlers from the Evt + * */ + detach(): Handler[]; + + /** https://docs.evt.land/api/evt/pipe */ + pipe(): Evt; + + pipe( + op: Operator.fλ + ): Evt; + pipe( + op: (data: T) => data is U + ): Evt; + pipe( + op: (data: T) => boolean + ): Evt; + + pipe(ctx: CtxLike): Evt; + + pipe( + ctx: CtxLike, + op: Operator.fλ + ): Evt; + pipe( + ctx: CtxLike, + op: (data: T) => data is U + ): Evt; + pipe( + ctx: CtxLike, + op: (data: T) => boolean + ): Evt; + + pipe( + op1: Operator.fλ, + op2: Operator.fλ + ): Evt; + pipe( + op1: Operator.fλ, + op2: (data: B) => data is C + ): Evt; + pipe( + op1: Operator.fλ, + op2: (data: B) => boolean + ): Evt; + pipe( + op1: (data: T) => data is B, + op2: Operator.fλ + ): Evt; + pipe( + op1: (data: T) => boolean, + op2: Operator.fλ + ): Evt; + pipe( + op1: (data: T) => data is B, + op2: (data: B) => data is C + ): Evt; + pipe( + op1: (data: T) => data is B, + op2: (data: B) => boolean + ): Evt; + pipe( + op1: (data: T) => boolean, + op2: (data: T) => data is B + ): Evt; + pipe( + op1: (data: T) => boolean, + op2: (data: T) => boolean + ): Evt; + + + pipe( + op1: Operator.fλ, + op2: Operator.fλ, + op3: Operator.fλ + ): Evt; + + pipe( + op1: Operator.fλ, + op2: Operator.fλ, + op3: Operator.fλ, + op4: Operator.fλ + ): Evt; + + pipe( + op1: Operator.fλ, + op2: Operator.fλ, + op3: Operator.fλ, + op4: Operator.fλ + ): Evt; + + pipe( + op1: Operator.fλ, + op2: Operator.fλ, + op3: Operator.fλ, + op4: Operator.fλ, + op5: Operator.fλ + ): Evt; + + + pipe( + op1: Operator, + op2: Operator + ): Evt; + + pipe( + op1: Operator, + op2: Operator, + op3: Operator + ): Evt; + + pipe( + op1: Operator, + op2: Operator, + op3: Operator, + op4: Operator + ): Evt; + + pipe( + op1: Operator, + op2: Operator, + op3: Operator, + op4: Operator, + op5: Operator + ): Evt; + + pipe( + ...ops: [ + Operator, + ...Operator[] + ] + ): Evt; + + pipe( + ...ops: [ + Operator, + ...Operator[] + ] + ): Evt; + + /** + * https://docs.evt.land/api/evt/waitfor + * + * op - fλ + * + * ctx + * + * timeout? + */ + waitFor( + op: Operator.fλ.Stateless, + ctx: CtxLike, + timeout?: number + ): Promise; + /** + * https://docs.evt.land/api/evt/waitfor + * + * op - Type guard + * + * ctx + * + * timeout? + */ + waitFor( + op: (data: T) => data is Q, + ctx: CtxLike, + timeout?: number + ): Promise; + /** + * https://docs.evt.land/api/evt/waitfor + * + * op - Filter + * + * ctx + * + * timeout? + */ + waitFor( + op: (data: T) => boolean, + ctx: CtxLike, + timeout?: number + ): Promise; + /** + * https://docs.evt.land/api/evt/waitfor + * + * op - fλ + * + * timeout? + */ + waitFor( + op: Operator.fλ.Stateless, + timeout?: number + ): Promise; + /** + * https://docs.evt.land/api/evt/waitfor + * + * op - Type guard + * + * timeout? + */ + waitFor( + op: (data: T) => data is Q, + timeout?: number + ): Promise; + /** + * https://docs.evt.land/api/evt/waitfor + * + * op - Filter + * + * timeout? + */ + waitFor( + op: (data: T) => boolean, + timeout?: number + ): Promise; + /** + * https://docs.evt.land/api/evt/waitfor + * + * ctx + * + * timeout? + */ + waitFor( + ctx: CtxLike, + timeout?: number + ): Promise; + /** + * https://docs.evt.land/api/evt/waitfor + * + * timeout? + */ + waitFor( + timeout?: number + ): Promise; + + [Symbol.asyncIterator](): AsyncIterator; + + /** + * https://docs.evt.land/api/evt/iter + * + * op - fλ + * + * ctx + * + * timeout? + */ + iter( + op: Operator.fλ.Stateless, + ctx: CtxLike, + timeout?: number + ): AsyncIterableEvt; + /** + * https://docs.evt.land/api/evt/iter + * + * op - Type guard + * + * ctx + * + * timeout? + */ + iter( + op: (data: T) => data is Q, + ctx: CtxLike, + timeout?: number + ): AsyncIterableEvt; + /** + * https://docs.evt.land/api/evt/iter + * + * op - Filter + * + * ctx + * + * timeout? + */ + iter( + op: (data: T) => boolean, + ctx: CtxLike, + timeout?: number + ): AsyncIterableEvt; + /** + * https://docs.evt.land/api/evt/iter + * + * op - fλ + * + * timeout? + */ + iter( + op: Operator.fλ.Stateless, + timeout?: number + ): AsyncIterableEvt; + /** + * https://docs.evt.land/api/evt/iter + * + * op - Type guard + * + * timeout? + */ + iter( + op: (data: T) => data is Q, + timeout?: number + ): AsyncIterableEvt; + /** + * https://docs.evt.land/api/evt/iter + * + * op - Filter + * + * timeout? + */ + iter( + op: (data: T) => boolean, + timeout?: number + ): AsyncIterableEvt; + /** + * https://docs.evt.land/api/evt/iter + * + * ctx + * + * timeout? + */ + iter( + ctx: CtxLike, + timeout?: number + ): AsyncIterableEvt; + /** + * https://docs.evt.land/api/evt/iter + * + * timeout? + */ + iter( + timeout?: number + ): AsyncIterableEvt; + + + /** + * https://docs.evt.land/api/evt/attach + * + * op - fλ + * + * ctx + * + * timeout + * + * callback + * + * NOTE: $attach() with '$' is to use only with fλ operators, + * if your operator return a boolean use the attach() without the '$' prefix. + */ + $attach( + op: Operator.fλ, + ctx: CtxLike, + timeout: number, + callback: (transformedData: U) => void + ): Promise; + /** + * https://docs.evt.land/api/evt/attach + * + * op - fλ + * + * ctx + * + * callback + * + * NOTE: $attach() with '$' is to use only with fλ operators, + * if your operator return a boolean use the attach() without the '$' prefix. + */ + $attach( + op: Operator.fλ, + ctx: CtxLike, + callback: (transformedData: U) => void + ): this; + /** + * https://docs.evt.land/api/evt/attach + * + * op - fλ + * + * timeout + * + * callback + * + * NOTE: $attach() with '$' is to use only with fλ operators, + * if your operator return a boolean use the attach() without the '$' prefix. + */ + $attach( + op: Operator.fλ, + timeout: number, + callback: (transformedData: U) => void + ): Promise; + /** + * https://docs.evt.land/api/evt/attach + * + * op - fλ + * + * callback + * + * NOTE: $attach() with '$' is to use only with fλ operators, + * if your operator return a boolean use the attach() without the '$' prefix. + */ + $attach( + op: Operator.fλ, + callback: (transformedData: U) => void + ): this; + + + + + + + + /** + * https://docs.evt.land/api/evt/attach + * + * op - Type guard + * + * ctx + * + * timeout + * + * callback + * + * NOTE: If you whish to use a fλ operator ( an operator that do not return a boolean ) + * the '$' prefix should be used ( use the $attach() method ) + * + */ + attach( + op: (data: T) => data is Q, + ctx: CtxLike, + timeout: number, + callback: (data: Q) => void + ): Promise; + /** + * https://docs.evt.land/api/evt/attach + * + * op - Filter + * + * ctx + * + * timeout + * + * callback + * + * NOTE: If you whish to use a fλ operator ( an operator that do not return a boolean ) + * the '$' prefix should be used ( use the $attach() method ) + */ + attach( + op: (data: T) => boolean, + ctx: CtxLike, + timeout: number, + callback: (data: T) => void + ): Promise; + /** + * https://docs.evt.land/api/evt/attach + * + * op - Type guard + * + * ctx + * + * callback + * + * NOTE: If you whish to use a fλ operator ( an operator that do not return a boolean ) + * the '$' prefix should be used ( use the $attach() method ) + */ + attach( + op: (data: T) => data is Q, + ctx: CtxLike, + callback: (data: Q) => void + ): this; + /** + * https://docs.evt.land/api/evt/attach + * + * op - Filter + * + * ctx + * + * callback + * + * NOTE: If you whish to use a fλ operator ( an operator that do not return a boolean ) + * the '$' prefix should be used ( use the $attach() method ) + */ + attach( + op: (data: T) => boolean, + ctx: CtxLike, + callback: (data: T) => void + ): this; + /** + * https://docs.evt.land/api/evt/attach + * + * op - Type guard + * + * timeout + * + * callback + * + * NOTE: If you whish to use a fλ operator ( an operator that do not return a boolean ) + * the '$' prefix should be used ( use the $attach() method ) + */ + attach( + op: (data: T) => data is Q, + timeout: number, + callback: (data: Q) => void + ): Promise; + /** + * https://docs.evt.land/api/evt/attach + * + * op - Filter + * + * timeout + * + * callback + * + * NOTE: If you whish to use a fλ operator ( an operator that do not return a boolean ) + * the '$' prefix should be used ( use the $attach() method ) + */ + attach( + op: (data: T) => boolean, + timeout: number, + callback: (data: T) => void + ): Promise; + /** + * https://docs.evt.land/api/evt/attach + * + * ctx + * + * timeout + * + * callback + */ + attach( + ctx: CtxLike, + timeout: number, + callback: (data: T) => void + ): Promise; + /** + * https://docs.evt.land/api/evt/attach + * + * op - Type guard + * + * callback + * + * NOTE: If you whish to use a fλ operator ( an operator that do not return a boolean ) + * the '$' prefix should be used ( use the $attach() method ) + */ + attach( + op: (data: T) => data is Q, + callback: (data: Q) => void + ): this; + /** + * https://docs.evt.land/api/evt/attach + * + * op - Filter + * + * callback + * + * NOTE: If you whish to use a fλ operator ( an operator that do not return a boolean ) + * the '$' prefix should be used ( use the $attach() method ) + */ + attach( + op: (data: T) => boolean, + callback: (data: T) => void + ): this; + /** + * https://docs.evt.land/api/evt/attach + * + * ctx + * + * callback + */ + attach( + ctx: CtxLike, + callback: (data: T) => void + ): this; + /** + * https://docs.evt.land/api/evt/attach + * + * timeout + * + * callback + */ + attach( + timeout: number, + callback: (data: T) => void + ): Promise; + /** + * https://docs.evt.land/api/evt/attach + * + * callback + */ + attach( + callback: (data: T) => void + ): this; + + + + + /** + * https://docs.evt.land/api/evt/attach + * + * op - fλ + * + * ctx + * + * timeout + * + * callback + * + * NOTE: $attachOnce() with '$' is to use only with fλ operators, + * if your operator return a boolean use the attachOnce() without the '$' prefix. + */ + $attachOnce( + op: Operator.fλ.Stateless, + ctx: CtxLike, + timeout: number, + callback: (transformedData: U) => void + ): Promise; + /** + * https://docs.evt.land/api/evt/attach + * + * op - fλ + * + * ctx + * + * callback + * + * NOTE: $attachOnce() with '$' is to use only with fλ operators, + * if your operator return a boolean use the attachOnce() without the '$' prefix. + */ + $attachOnce( + op: Operator.fλ.Stateless, + ctx: CtxLike, + callback: (transformedData: U) => void + ): this; + /** + * https://docs.evt.land/api/evt/attach + * + * op - fλ + * + * timeout + * + * callback + * + * NOTE: $attachOnce() with '$' is to use only with fλ operators, + * if your operator return a boolean use the attachOnce() without the '$' prefix. + */ + $attachOnce( + op: Operator.fλ.Stateless, + timeout: number, + callback: (transformedData: U) => void + ): Promise; + /** + * https://docs.evt.land/api/evt/attach + * + * op - fλ + * + * callback + * + * NOTE: $attachOnce() with '$' is to use only with fλ operators, + * if your operator return a boolean use the attachOnce() without the '$' prefix. + */ + $attachOnce( + op: Operator.fλ.Stateless, + callback: (transformedData: U) => void + ): this; + + + + + + + /** + * https://docs.evt.land/api/evt/attach + * + * op - Type guard + * + * ctx + * + * timeout + * + * callback + * + * NOTE: If you whish to use a fλ operator ( an operator that do not return a boolean ) + * the '$' prefix should be used ( use the $attachOnce() method ) + */ + attachOnce( + op: (data: T) => data is Q, + ctx: CtxLike, + timeout: number, + callback: (data: Q) => void + ): Promise; + /** + * https://docs.evt.land/api/evt/attach + * + * op - Filter + * + * ctx + * + * timeout + * + * callback + * + * NOTE: If you whish to use a fλ operator ( an operator that do not return a boolean ) + * the '$' prefix should be used ( use the $attachOnce() method ) + */ + attachOnce( + op: (data: T) => boolean, + ctx: CtxLike, + timeout: number, + callback: (data: T) => void + ): Promise; + /** + * https://docs.evt.land/api/evt/attach + * + * op - Type guard + * + * ctx + * + * callback + * + * NOTE: If you whish to use a fλ operator ( an operator that do not return a boolean ) + * the '$' prefix should be used ( use the $attachOnce() method ) + */ + attachOnce( + op: (data: T) => data is Q, + ctx: CtxLike, + callback: (data: Q) => void + ): this; + /** + * https://docs.evt.land/api/evt/attach + * + * op - Filter + * + * ctx + * + * callback + * + * NOTE: If you whish to use a fλ operator ( an operator that do not return a boolean ) + * the '$' prefix should be used ( use the $attachOnce() method ) + */ + attachOnce( + op: (data: T) => boolean, + ctx: CtxLike, + callback: (data: T) => void + ): this; + /** + * https://docs.evt.land/api/evt/attach + * + * op - Type guard + * + * timeout + * + * callback + * + * NOTE: If you whish to use a fλ operator ( an operator that do not return a boolean ) + * the '$' prefix should be used ( use the $attachOnce() method ) + */ + attachOnce( + op: (data: T) => data is Q, + timeout: number, + callback: (data: Q) => void + ): Promise; + /** + * https://docs.evt.land/api/evt/attach + * + * op - Filter + * + * timeout + * + * callback + * + * NOTE: If you whish to use a fλ operator ( an operator that do not return a boolean ) + * the '$' prefix should be used ( use the $attachOnce() method ) + */ + attachOnce( + op: (data: T) => boolean, + timeout: number, + callback: (data: T) => void + ): Promise; + /** + * https://docs.evt.land/api/evt/attach + * + * ctx + * + * timeout + * + * callback + */ + attachOnce( + ctx: CtxLike, + timeout: number, + callback: (data: T) => void + ): Promise; + /** + * https://docs.evt.land/api/evt/attach + * + * op - Type guard + * + * callback + * + * NOTE: If you whish to use a fλ operator ( an operator that do not return a boolean ) + * the '$' prefix should be used ( use the $attachOnce() method ) + */ + attachOnce( + op: (data: T) => data is Q, + callback: (data: Q) => void + ): this; + /** + * https://docs.evt.land/api/evt/attach + * + * op - Filter + * + * callback + * + * NOTE: If you whish to use a fλ operator ( an operator that do not return a boolean ) + * the '$' prefix should be used ( use the $attachOnce() method ) + */ + attachOnce( + op: (data: T) => boolean, + callback: (data: T) => void + ): this; + /** + * https://docs.evt.land/api/evt/attach + * + * ctx + * + * callback + */ + attachOnce( + ctx: CtxLike, + callback: (data: T) => void + ): this; + /** + * https://docs.evt.land/api/evt/attach + * + * timeout + * + * callback + */ + attachOnce( + timeout: number, + callback: (data: T) => void + ): Promise; + /** + * https://docs.evt.land/api/evt/attach + * + * callback + */ + attachOnce( + callback: (data: T) => void + ): this; + + + + + + /** + * https://docs.evt.land/api/evt/attach + * + * op - fλ + * + * ctx + * + * timeout + * + * callback + * + * NOTE: $attach() with '$' is to use only with fλ operators, + * if your operator return a boolean use the attach() without the '$' prefix. + */ + $attachExtract( + op: Operator.fλ, + ctx: CtxLike, + timeout: number, + callback: (transformedData: U) => void + ): Promise; + /** + * https://docs.evt.land/api/evt/attach + * + * op - fλ + * + * ctx + * + * callback + * + * NOTE: $attach() with '$' is to use only with fλ operators, + * if your operator return a boolean use the attach() without the '$' prefix. + */ + $attachExtract( + op: Operator.fλ, + ctx: CtxLike, + callback: (transformedData: U) => void + ): this; + /** + * https://docs.evt.land/api/evt/attach + * + * op - fλ + * + * timeout + * + * callback + * + * NOTE: $attach() with '$' is to use only with fλ operators, + * if your operator return a boolean use the attach() without the '$' prefix. + */ + $attachExtract( + op: Operator.fλ, + timeout: number, + callback: (transformedData: U) => void + ): Promise; + /** + * https://docs.evt.land/api/evt/attach + * + * op - fλ + * + * callback + * + * NOTE: $attach() with '$' is to use only with fλ operators, + * if your operator return a boolean use the attach() without the '$' prefix. + */ + $attachExtract( + op: Operator.fλ, + callback: (transformedData: U) => void + ): this; + + + + + + + + + /** + * https://docs.evt.land/api/evt/attach + * + * op - Type guard + * + * ctx + * + * timeout + * + * callback + */ + attachExtract( + op: (data: T) => data is Q, + ctx: CtxLike, + timeout: number, + callback: (data: Q) => void + ): Promise; + /** + * https://docs.evt.land/api/evt/attach + * + * op - Filter + * + * ctx + * + * timeout + * + * callback + */ + attachExtract( + op: (data: T) => boolean, + ctx: CtxLike, + timeout: number, + callback: (data: T) => void + ): Promise; + /** + * https://docs.evt.land/api/evt/attach + * + * op - Type guard + * + * ctx + * + * callback + */ + attachExtract( + op: (data: T) => data is Q, + ctx: CtxLike, + callback: (data: Q) => void + ): this; + /** + * https://docs.evt.land/api/evt/attach + * + * op - Filter + * + * ctx + * + * callback + */ + attachExtract( + op: (data: T) => boolean, + ctx: CtxLike, + callback: (data: T) => void + ): this; + /** + * https://docs.evt.land/api/evt/attach + * + * op - Type guard + * + * timeout + * + * callback + */ + attachExtract( + op: (data: T) => data is Q, + timeout: number, + callback: (data: Q) => void + ): Promise; + /** + * https://docs.evt.land/api/evt/attach + * + * op - Filter + * + * timeout + * + * callback + */ + attachExtract( + op: (data: T) => boolean, + timeout: number, + callback: (data: T) => void + ): Promise; + /** + * https://docs.evt.land/api/evt/attach + * + * ctx + * + * timeout + */ + attachExtract( + ctx: CtxLike, + timeout: number, + callback: (data: T) => void + ): Promise; + /** + * https://docs.evt.land/api/evt/attach + * + * op - Type guard + * + * callback + */ + attachExtract( + op: (data: T) => data is Q, + callback: (data: Q) => void + ): this; + /** + * https://docs.evt.land/api/evt/attach + * + * op - Filter + * + * callback + */ + attachExtract( + op: (data: T) => boolean, + callback: (data: T) => void + ): this; + /** + * https://docs.evt.land/api/evt/attach + * + * ctx + * + * callback + */ + attachExtract( + ctx: CtxLike, + callback: (data: T) => void + ): this; + /** + * https://docs.evt.land/api/evt/attach + * + * timeout + * + * callback + */ + attachExtract( + timeout: number, + callback: (data: T) => void + ): Promise; + /** + * https://docs.evt.land/api/evt/attach + * + * callback + */ + attachExtract( + callback: (data: T) => void + ): this; + + + + + + + + + + + + /** + * https://docs.evt.land/api/evt/attach + * + * op - fλ + * + * ctx + * + * timeout + * + * callback + * + * NOTE: $attach() with '$' is to use only with fλ operators, + * if your operator return a boolean use the attach() without the '$' prefix. + */ + $attachPrepend( + op: Operator.fλ, + ctx: CtxLike, + timeout: number, + callback: (transformedData: U) => void + ): Promise; + /** + * https://docs.evt.land/api/evt/attach + * + * op - fλ + * + * ctx + * + * callback + * + * NOTE: $attach() with '$' is to use only with fλ operators, + * if your operator return a boolean use the attach() without the '$' prefix. + */ + $attachPrepend( + op: Operator.fλ, + ctx: CtxLike, + callback: (transformedData: U) => void + ): this; + /** + * https://docs.evt.land/api/evt/attach + * + * op - fλ + * + * timeout + * + * callback + * + * NOTE: $attach() with '$' is to use only with fλ operators, + * if your operator return a boolean use the attach() without the '$' prefix. + */ + $attachPrepend( + op: Operator.fλ, + timeout: number, + callback: (transformedData: U) => void + ): Promise; + /** + * https://docs.evt.land/api/evt/attach + * + * op - fλ + * + * callback + * + * NOTE: $attach() with '$' is to use only with fλ operators, + * if your operator return a boolean use the attach() without the '$' prefix. + */ + $attachPrepend( + op: Operator.fλ, + callback: (transformedData: U) => void + ): this; + + + + + + + + + + /** + * https://docs.evt.land/api/evt/attach + * + * op - Type guard + * + * ctx + * + * timeout + * + * callback + */ + attachPrepend( + op: (data: T) => data is Q, + ctx: CtxLike, + timeout: number, + callback: (data: Q) => void + ): Promise; + + /** + * https://docs.evt.land/api/evt/attach + * + * op - Filter + * + * ctx + * + * timeout + * + * callback + */ + attachPrepend( + op: (data: T) => boolean, + ctx: CtxLike, + timeout: number, + callback: (data: T) => void + ): Promise; + + /** + * https://docs.evt.land/api/evt/attach + * + * op - Type guard + * + * ctx + * + * callback + */ + attachPrepend( + op: (data: T) => data is Q, + ctx: CtxLike, + callback: (data: Q) => void + ): this; + /** + * https://docs.evt.land/api/evt/attach + * + * op - Filter + * + * ctx + * + * callback + */ + attachPrepend( + op: (data: T) => boolean, + ctx: CtxLike, + callback: (data: T) => void + ): this; + /** + * https://docs.evt.land/api/evt/attach + * + * op - Type guard + * + * timeout + * + * callback + */ + attachPrepend( + op: (data: T) => data is Q, + timeout: number, + callback: (data: Q) => void + ): Promise; + /** + * https://docs.evt.land/api/evt/attach + * + * op - Filter + * + * timeout + * + * callback + */ + attachPrepend( + op: (data: T) => boolean, + timeout: number, + callback: (data: T) => void + ): Promise; + /** + * https://docs.evt.land/api/evt/attach + * + * ctx + * + * timeout + * + * callback + */ + attachPrepend( + ctx: CtxLike, + timeout: number, + callback: (data: T) => void + ): Promise; + /** + * https://docs.evt.land/api/evt/attach + * + * op - Type guard + * + * callback + */ + attachPrepend( + op: (data: T) => data is Q, + callback: (data: Q) => void + ): this; + /** + * https://docs.evt.land/api/evt/attach + * + * op - Filter + * + * callback + */ + attachPrepend( + op: (data: T) => boolean, + callback: (data: T) => void + ): this; + /** + * https://docs.evt.land/api/evt/attach + * + * ctx + * + * callback + */ + attachPrepend( + ctx: CtxLike, + callback: (data: T) => void + ): this; + /** + * https://docs.evt.land/api/evt/attach + * + * timeout + * + * callback + */ + attachPrepend( + timeout: number, + callback: (data: T) => void + ): Promise; + /** + * https://docs.evt.land/api/evt/attach + * + * callback + */ + attachPrepend( + callback: (data: T) => void + ): this; + + + + + + + + /** + * https://docs.evt.land/api/evt/attach + * + * op - fλ + * + * ctx + * + * timeout + * + * callback + * + * NOTE: $attach() with '$' is to use only with fλ operators, + * if your operator return a boolean use the attach() without the '$' prefix. + */ + $attachOncePrepend( + op: Operator.fλ.Stateless, + ctx: CtxLike, + timeout: number, + callback: (transformedData: U) => void + ): Promise; + /** + * https://docs.evt.land/api/evt/attach + * + * op - fλ + * + * ctx + * + * callback + * + * NOTE: $attach() with '$' is to use only with fλ operators, + * if your operator return a boolean use the attach() without the '$' prefix. + */ + $attachOncePrepend( + op: Operator.fλ.Stateless, + ctx: CtxLike, + callback: (transformedData: U) => void + ): this; + /** + * https://docs.evt.land/api/evt/attach + * + * op - fλ + * + * timeout + * + * callback + * + * NOTE: $attach() with '$' is to use only with fλ operators, + * if your operator return a boolean use the attach() without the '$' prefix. + */ + $attachOncePrepend( + op: Operator.fλ.Stateless, + timeout: number, + callback: (transformedData: U) => void + ): Promise; + /** + * https://docs.evt.land/api/evt/attach + * + * op - fλ + * + * callback + * + * NOTE: $attach() with '$' is to use only with fλ operators, + * if your operator return a boolean use the attach() without the '$' prefix. + */ + $attachOncePrepend( + op: Operator.fλ.Stateless, + callback: (transformedData: U) => void + ): this; + + + + + + + + + + /** + * https://docs.evt.land/api/evt/attach + * + * op - Type guard + * + * ctx + * + * timeout + * + * callback + */ + attachOncePrepend( + op: (data: T) => data is Q, + ctx: CtxLike, + timeout: number, + callback: (data: Q) => void + ): Promise; + /** + * https://docs.evt.land/api/evt/attach + * + * op - Filter + * + * ctx + * + * timeout + * + * callback + */ + attachOncePrepend( + op: (data: T) => boolean, + ctx: CtxLike, + timeout: number, + callback: (data: T) => void + ): Promise; + /** + * https://docs.evt.land/api/evt/attach + * + * op - Type guard + * + * ctx + * + * callback + */ + attachOncePrepend( + op: (data: T) => data is Q, + ctx: CtxLike, + callback: (data: Q) => void + ): this; + /** + * https://docs.evt.land/api/evt/attach + * + * op - Filter + * + * ctx + * + * callback + */ + attachOncePrepend( + op: (data: T) => boolean, + ctx: CtxLike, + callback: (data: T) => void + ): this; + /** + * https://docs.evt.land/api/evt/attach + * + * op - Type guard + * + * timeout + * + * callback + */ + attachOncePrepend( + op: (data: T) => data is Q, + timeout: number, + callback: (data: Q) => void + ): Promise; + /** + * https://docs.evt.land/api/evt/attach + * + * op - Filter + * + * timeout + * + * callback + */ + attachOncePrepend( + op: (data: T) => boolean, + timeout: number, + callback: (data: T) => void + ): Promise; + /** + * https://docs.evt.land/api/evt/attach + * + * ctx + * + * timeout + * + * callback + */ + attachOncePrepend( + ctx: CtxLike, + timeout: number, + callback: (data: T) => void + ): Promise; + /** + * https://docs.evt.land/api/evt/attach + * + * op - Type guard + * + * callback + */ + attachOncePrepend( + op: (data: T) => data is Q, + callback: (data: Q) => void + ): this; + /** + * https://docs.evt.land/api/evt/attach + * + * op - Filter + * + * callback + */ + attachOncePrepend( + op: (data: T) => boolean, + callback: (data: T) => void + ): this; + /** + * https://docs.evt.land/api/evt/attach + * + * ctx + * + * callback + */ + attachOncePrepend( + ctx: CtxLike, + callback: (data: T) => void + ): this; + /** + * https://docs.evt.land/api/evt/attach + * + * timeout + * + * callback + */ + attachOncePrepend( + timeout: number, + callback: (data: T) => void + ): Promise; + /** + * https://docs.evt.land/api/evt/attach + * + * callback + */ + attachOncePrepend( + callback: (data: T) => void + ): this; + + + + + + + + + /** + * https://docs.evt.land/api/evt/attach + * + * op - fλ + * + * ctx + * + * timeout + * + * callback + * + * NOTE: $attach() with '$' is to use only with fλ operators, + * if your operator return a boolean use the attach() without the '$' prefix. + */ + $attachOnceExtract( + op: Operator.fλ.Stateless, + ctx: CtxLike, + timeout: number, + callback: (transformedData: U) => void + ): Promise; + /** + * https://docs.evt.land/api/evt/attach + * + * op - fλ + * + * ctx + * + * callback + * + * NOTE: $attach() with '$' is to use only with fλ operators, + * if your operator return a boolean use the attach() without the '$' prefix. + */ + $attachOnceExtract( + op: Operator.fλ.Stateless, + ctx: CtxLike, + callback: (transformedData: U) => void + ): this; + /** + * https://docs.evt.land/api/evt/attach + * + * op - fλ + * + * timeout + * + * callback + * + * NOTE: $attach() with '$' is to use only with fλ operators, + * if your operator return a boolean use the attach() without the '$' prefix. + */ + $attachOnceExtract( + op: Operator.fλ.Stateless, + timeout: number, + callback: (transformedData: U) => void + ): Promise; + /** + * https://docs.evt.land/api/evt/attach + * + * op - fλ + * + * callback + * + * NOTE: $attach() with '$' is to use only with fλ operators, + * if your operator return a boolean use the attach() without the '$' prefix. + */ + $attachOnceExtract( + op: Operator.fλ.Stateless, + callback: (transformedData: U) => void + ): this; + + + + + + + + + /** + * https://docs.evt.land/api/evt/attach + * + * op - Type guard + * + * ctx + * + * timeout + * + * callback + */ + attachOnceExtract( + op: (data: T) => data is Q, + ctx: CtxLike, + timeout: number, + callback: (data: Q) => void + ): Promise; + /** + * https://docs.evt.land/api/evt/attach + * + * op - Filter + * + * ctx + * + * timeout + * + * callback + */ + attachOnceExtract( + op: (data: T) => boolean, + ctx: CtxLike, + timeout: number, + callback: (data: T) => void + ): Promise; + /** + * https://docs.evt.land/api/evt/attach + * + * op - Type guard + * + * ctx + * + * callback + */ + attachOnceExtract( + op: (data: T) => data is Q, + ctx: CtxLike, + callback: (data: Q) => void + ): this; + /** + * https://docs.evt.land/api/evt/attach + * + * op - Filter + * + * ctx + * + * callback + */ + attachOnceExtract( + op: (data: T) => boolean, + ctx: CtxLike, + callback: (data: T) => void + ): this; + /** + * https://docs.evt.land/api/evt/attach + * + * op - Type guard + * + * timeout + * + * callback + */ + attachOnceExtract( + op: (data: T) => data is Q, + timeout: number, + callback: (data: Q) => void + ): Promise; + /** + * https://docs.evt.land/api/evt/attach + * + * op - Filter + * + * timeout + * + * callback + */ + attachOnceExtract( + op: (data: T) => boolean, + timeout: number, + callback: (data: T) => void + ): Promise; + /** + * https://docs.evt.land/api/evt/attach + * + * ctx + * + * timeout + */ + attachOnceExtract( + ctx: CtxLike, + timeout: number, + callback: (data: T) => void + ): Promise; + /** + * https://docs.evt.land/api/evt/attach + * + * op - Type guard + * + * callback + */ + attachOnceExtract( + op: (data: T) => data is Q, + callback: (data: Q) => void + ): this; + /** + * https://docs.evt.land/api/evt/attach + * + * op - Filter + * + * callback + */ + attachOnceExtract( + op: (data: T) => boolean, + callback: (data: T) => void + ): this; + /** + * https://docs.evt.land/api/evt/attach + * + * ctx + * + * callback + */ + attachOnceExtract( + ctx: CtxLike, + callback: (data: T) => void + ): this; + /** + * https://docs.evt.land/api/evt/attach + * + * timeout + * + * callback + */ + attachOnceExtract( + timeout: number, + callback: (data: T) => void + ): Promise; + /** + * https://docs.evt.land/api/evt/attach + * + * callback + */ + attachOnceExtract( + callback: (data: T) => void + ): this; + +} + + + diff --git a/deno_dist/lib/types/interfaces/NonPostableEvtLike.ts b/deno_dist/lib/types/interfaces/NonPostableEvtLike.ts new file mode 100644 index 00000000..8989cd3b --- /dev/null +++ b/deno_dist/lib/types/interfaces/NonPostableEvtLike.ts @@ -0,0 +1,7 @@ + +import type { CtxLike } from "./CtxLike.ts"; + +export interface NonPostableEvtLike { + attach(ctx: CtxLike, callback: (data: T) => void): void; + attach(callback: (data: T) => void): void; +}; \ No newline at end of file diff --git a/deno_dist/lib/types/interfaces/Postable.ts b/deno_dist/lib/types/interfaces/Postable.ts new file mode 100644 index 00000000..5aebe21c --- /dev/null +++ b/deno_dist/lib/types/interfaces/Postable.ts @@ -0,0 +1,19 @@ + +export interface Postable { + + /** https://docs.evt.land/api/evt/post */ + postAsyncOnceHandled(data: T): number | Promise; + + /** + * Returns post count + * */ + post(data: T): number; + + /** + * Post and wait for all async handler's callbacks have resolved. + * + * https://docs.evt.land/api/evt/post#evt-postandwait-data-promise-less-than-void-greater-than + */ + postAndWait(data: T): Promise; + +} diff --git a/deno_dist/lib/types/interfaces/StatefulEvt.ts b/deno_dist/lib/types/interfaces/StatefulEvt.ts new file mode 100644 index 00000000..dc8c088f --- /dev/null +++ b/deno_dist/lib/types/interfaces/StatefulEvt.ts @@ -0,0 +1,10 @@ +import type { StatefulReadonlyEvt } from "./StatefulReadonlyEvt.ts"; +import type { StatefulPostable } from "./StatefulPostable.ts"; + + +export interface StatefulEvt extends StatefulReadonlyEvt, StatefulPostable { + + /** https://docs.evt.land/api/statefulevt#state */ + state: T; + +}; diff --git a/deno_dist/lib/types/interfaces/StatefulEvtLike.ts b/deno_dist/lib/types/interfaces/StatefulEvtLike.ts new file mode 100644 index 00000000..2f61f356 --- /dev/null +++ b/deno_dist/lib/types/interfaces/StatefulEvtLike.ts @@ -0,0 +1,6 @@ + +import type { EvtLike } from "./EvtLike.ts"; + +export interface StatefulEvtLike extends EvtLike { + state: T; +}; diff --git a/deno_dist/lib/types/interfaces/StatefulPostable.ts b/deno_dist/lib/types/interfaces/StatefulPostable.ts new file mode 100644 index 00000000..917957fb --- /dev/null +++ b/deno_dist/lib/types/interfaces/StatefulPostable.ts @@ -0,0 +1,11 @@ + +import type { Postable } from "./Postable.ts"; + +export interface StatefulPostable extends Postable { + + state: T; + + /** https://docs.evt.land/api/statefulevt#postfocechange */ + postForceChange(wData?: readonly [T]): number; + +} diff --git a/deno_dist/lib/types/interfaces/StatefulReadonlyEvt.ts b/deno_dist/lib/types/interfaces/StatefulReadonlyEvt.ts new file mode 100644 index 00000000..fbdb7190 --- /dev/null +++ b/deno_dist/lib/types/interfaces/StatefulReadonlyEvt.ts @@ -0,0 +1,163 @@ + +import type { Operator } from "../Operator.ts"; + +import type { NonPostableEvt } from "./NonPostableEvt.ts"; +import type { CtxLike } from "./CtxLike.ts"; +import type { StatefulEvt } from "./StatefulEvt.ts"; +import type { Evt } from "./Evt.ts"; + +export type StateDiff = { prevState: T, newState: T }; + +export interface StatefulReadonlyEvt extends NonPostableEvt { + + /** https://docs.evt.land/api/statefulevt#tostateless-ctx */ + toStateless(ctx?: CtxLike): Evt; + + readonly state: T; + + /** https://docs.evt.land/api/statefulevt#evtdiff */ + readonly evtDiff: NonPostableEvt>; + + /** https://docs.evt.land/api/statefulevt#evtchange */ + readonly evtChange: StatefulReadonlyEvt; + + /** https://docs.evt.land/api/statefulevt#evtchangediff */ + readonly evtChangeDiff: NonPostableEvt>; + + /** https://docs.evt.land/api/statefulevt#pipe */ + pipe(): StatefulEvt; + + pipe( + op: Operator.fλ + ): StatefulEvt; + pipe( + op: (data: T) => data is U + ): StatefulEvt; + pipe( + op: (data: T) => boolean + ): StatefulEvt; + + pipe(ctx: CtxLike): StatefulEvt; + + pipe( + ctx: CtxLike, + op: Operator.fλ + ): StatefulEvt; + pipe( + ctx: CtxLike, + op: (data: T) => data is U + ): StatefulEvt; + pipe( + ctx: CtxLike, + op: (data: T) => boolean + ): StatefulEvt; + + pipe( + op1: Operator.fλ, + op2: Operator.fλ + ): StatefulEvt; + pipe( + op1: Operator.fλ, + op2: (data: B) => data is C + ): StatefulEvt; + pipe( + op1: Operator.fλ, + op2: (data: B) => boolean + ): StatefulEvt; + pipe( + op1: (data: T) => data is B, + op2: Operator.fλ + ): StatefulEvt; + pipe( + op1: (data: T) => boolean, + op2: Operator.fλ + ): StatefulEvt; + pipe( + op1: (data: T) => data is B, + op2: (data: B) => data is C + ): StatefulEvt; + pipe( + op1: (data: T) => data is B, + op2: (data: B) => boolean + ): StatefulEvt; + pipe( + op1: (data: T) => boolean, + op2: (data: T) => data is B + ): StatefulEvt; + pipe( + op1: (data: T) => boolean, + op2: (data: T) => boolean + ): StatefulEvt; + + + pipe( + op1: Operator.fλ, + op2: Operator.fλ, + op3: Operator.fλ + ): StatefulEvt; + + pipe( + op1: Operator.fλ, + op2: Operator.fλ, + op3: Operator.fλ, + op4: Operator.fλ + ): StatefulEvt; + + pipe( + op1: Operator.fλ, + op2: Operator.fλ, + op3: Operator.fλ, + op4: Operator.fλ + ): StatefulEvt; + + pipe( + op1: Operator.fλ, + op2: Operator.fλ, + op3: Operator.fλ, + op4: Operator.fλ, + op5: Operator.fλ + ): StatefulEvt; + + + pipe( + op1: Operator, + op2: Operator + ): StatefulEvt; + + pipe( + op1: Operator, + op2: Operator, + op3: Operator + ): StatefulEvt; + + pipe( + op1: Operator, + op2: Operator, + op3: Operator, + op4: Operator + ): StatefulEvt; + + pipe( + op1: Operator, + op2: Operator, + op3: Operator, + op4: Operator, + op5: Operator + ): StatefulEvt; + + pipe( + ...ops: [ + Operator, + ...Operator[] + ] + ): StatefulEvt; + + pipe( + ...ops: [ + Operator, + ...Operator[] + ] + ): StatefulEvt; + +} + diff --git a/deno_dist/lib/types/interfaces/StatefulReadonlyEvtLike.ts b/deno_dist/lib/types/interfaces/StatefulReadonlyEvtLike.ts new file mode 100644 index 00000000..35b83c4a --- /dev/null +++ b/deno_dist/lib/types/interfaces/StatefulReadonlyEvtLike.ts @@ -0,0 +1,6 @@ + +import type { NonPostableEvtLike } from "./NonPostableEvtLike.ts"; + +export interface StatefulReadonlyEvtLike extends NonPostableEvtLike { + readonly state: T; +}; diff --git a/deno_dist/lib/types/interfaces/index.ts b/deno_dist/lib/types/interfaces/index.ts new file mode 100644 index 00000000..ab0b3b86 --- /dev/null +++ b/deno_dist/lib/types/interfaces/index.ts @@ -0,0 +1,12 @@ +export type { Ctx, DoneOrAborted } from "./Ctx.ts"; +export * from "./CtxLike.ts"; +export type { Evt } from "./Evt.ts"; +export type { NonPostableEvt } from "./NonPostableEvt.ts"; +export type { Postable } from "./Postable.ts"; +export type { StatefulEvt } from "./StatefulEvt.ts"; +export type { StatefulReadonlyEvt, StateDiff } from "./StatefulReadonlyEvt.ts"; +export type { StatefulPostable } from "./StatefulPostable.ts"; +export type { EvtLike } from "./EvtLike.ts"; +export type { NonPostableEvtLike } from "./NonPostableEvtLike.ts"; +export type { StatefulReadonlyEvtLike } from "./StatefulReadonlyEvtLike.ts"; +export type { StatefulEvtLike } from "./StatefulEvtLike.ts"; diff --git a/deno_dist/lib/types/lib.dom.ts b/deno_dist/lib/types/lib.dom.ts new file mode 100644 index 00000000..3664d185 --- /dev/null +++ b/deno_dist/lib/types/lib.dom.ts @@ -0,0 +1,16199 @@ + +/* +This is a curated re export of the dom API definitions. + +The DOM definitions are available only when "compilerOptions": { "lib": ["DOM"] }} +is present in the tsconfig.json. + +We need we re-export those definitions so that we can expose methods that interact with +the DOM ( ex Evt.from ) while not producing type error when +EVT is imported in project that does not use 'lib DOM', typically +projects that targets Node.JS. +*/ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + +export const __hack= "NOT TYPE ONLY"; + +///////////////////////////// +/// DOM APIs +///////////////////////////// + +export interface Account { + displayName: string; + id: string; + imageURL?: string; + name?: string; + rpDisplayName: string; +} + +export interface AddEventListenerOptions extends EventListenerOptions { + once?: boolean; + passive?: boolean; +} + +export interface AesCbcParams extends Algorithm { + iv: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer; +} + +export interface AesCtrParams extends Algorithm { + counter: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer; + length: number; +} + +export interface AesDerivedKeyParams extends Algorithm { + length: number; +} + +export interface AesGcmParams extends Algorithm { + additionalData?: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer; + iv: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer; + tagLength?: number; +} + +export interface AesKeyAlgorithm extends KeyAlgorithm { + length: number; +} + +export interface AesKeyGenParams extends Algorithm { + length: number; +} + +export interface Algorithm { + name: string; +} + +export interface AnalyserOptions extends AudioNodeOptions { + fftSize?: number; + maxDecibels?: number; + minDecibels?: number; + smoothingTimeConstant?: number; +} + +export interface AnimationEventInit extends EventInit { + animationName?: string; + elapsedTime?: number; + pseudoElement?: string; +} + +export interface AnimationPlaybackEventInit extends EventInit { + currentTime?: number | null; + timelineTime?: number | null; +} + +export interface AssertionOptions { + allowList?: ScopedCredentialDescriptor[]; + extensions?: WebAuthnExtensions; + rpId?: string; + timeoutSeconds?: number; +} + +export interface AssignedNodesOptions { + flatten?: boolean; +} + +export interface AudioBufferOptions { + length: number; + numberOfChannels?: number; + sampleRate: number; +} + +export interface AudioBufferSourceOptions { + buffer?: AudioBuffer | null; + detune?: number; + loop?: boolean; + loopEnd?: number; + loopStart?: number; + playbackRate?: number; +} + +export interface AudioContextInfo { + currentTime?: number; + sampleRate?: number; +} + +export interface AudioContextOptions { + latencyHint?: AudioContextLatencyCategory | number; + sampleRate?: number; +} + +export interface AudioNodeOptions { + channelCount?: number; + channelCountMode?: ChannelCountMode; + channelInterpretation?: ChannelInterpretation; +} + +export interface AudioParamDescriptor { + automationRate?: AutomationRate; + defaultValue?: number; + maxValue?: number; + minValue?: number; + name: string; +} + +export interface AudioProcessingEventInit extends EventInit { + inputBuffer: AudioBuffer; + outputBuffer: AudioBuffer; + playbackTime: number; +} + +export interface AudioTimestamp { + contextTime?: number; + performanceTime?: number; +} + +export interface AudioWorkletNodeOptions extends AudioNodeOptions { + numberOfInputs?: number; + numberOfOutputs?: number; + outputChannelCount?: number[]; + parameterData?: Record; + processorOptions?: any; +} + +export interface AuthenticationExtensionsClientInputs { + appid?: string; + authnSel?: AuthenticatorSelectionList; + exts?: boolean; + loc?: boolean; + txAuthGeneric?: txAuthGenericArg; + txAuthSimple?: string; + uvi?: boolean; + uvm?: boolean; +} + +export interface AuthenticationExtensionsClientOutputs { + appid?: boolean; + authnSel?: boolean; + exts?: AuthenticationExtensionsSupported; + loc?: Coordinates; + txAuthGeneric?: ArrayBuffer; + txAuthSimple?: string; + uvi?: ArrayBuffer; + uvm?: UvmEntries; +} + +export interface AuthenticatorSelectionCriteria { + authenticatorAttachment?: AuthenticatorAttachment; + requireResidentKey?: boolean; + userVerification?: UserVerificationRequirement; +} + +export interface BiquadFilterOptions extends AudioNodeOptions { + Q?: number; + detune?: number; + frequency?: number; + gain?: number; + type?: BiquadFilterType; +} + +export interface BlobPropertyBag { + endings?: EndingType; + type?: string; +} + +export interface ByteLengthChunk { + byteLength?: number; +} + +export interface CacheQueryOptions { + ignoreMethod?: boolean; + ignoreSearch?: boolean; + ignoreVary?: boolean; +} + +export interface CanvasRenderingContext2DSettings { + alpha?: boolean; + desynchronized?: boolean; +} + +export interface ChannelMergerOptions extends AudioNodeOptions { + numberOfInputs?: number; +} + +export interface ChannelSplitterOptions extends AudioNodeOptions { + numberOfOutputs?: number; +} + +export interface ClientData { + challenge: string; + extensions?: WebAuthnExtensions; + hashAlg: string | Algorithm; + origin: string; + rpId: string; + tokenBinding?: string; +} + +export interface ClientQueryOptions { + includeUncontrolled?: boolean; + type?: ClientTypes; +} + +export interface ClipboardEventInit extends EventInit { + clipboardData?: DataTransfer | null; +} + +export interface CloseEventInit extends EventInit { + code?: number; + reason?: string; + wasClean?: boolean; +} + +export interface CompositionEventInit extends UIEventInit { + data?: string; +} + +export interface ComputedEffectTiming extends EffectTiming { + activeDuration?: number; + currentIteration?: number | null; + endTime?: number; + localTime?: number | null; + progress?: number | null; +} + +export interface ComputedKeyframe { + composite: CompositeOperationOrAuto; + computedOffset: number; + easing: string; + offset: number | null; + [property: string]: string | number | null | undefined; +} + +export interface ConfirmSiteSpecificExceptionsInformation extends ExceptionInformation { + arrayOfDomainStrings?: string[]; +} + +export interface ConstantSourceOptions { + offset?: number; +} + +export interface ConstrainBooleanParameters { + exact?: boolean; + ideal?: boolean; +} + +export interface ConstrainDOMStringParameters { + exact?: string | string[]; + ideal?: string | string[]; +} + +export interface ConstrainDoubleRange extends DoubleRange { + exact?: number; + ideal?: number; +} + +export interface ConstrainULongRange extends ULongRange { + exact?: number; + ideal?: number; +} + +export interface ConstrainVideoFacingModeParameters { + exact?: VideoFacingModeEnum | VideoFacingModeEnum[]; + ideal?: VideoFacingModeEnum | VideoFacingModeEnum[]; +} + +export interface ConvolverOptions extends AudioNodeOptions { + buffer?: AudioBuffer | null; + disableNormalization?: boolean; +} + +export interface CredentialCreationOptions { + publicKey?: PublicKeyCredentialCreationOptions; + signal?: AbortSignal; +} + +export interface CredentialRequestOptions { + mediation?: CredentialMediationRequirement; + publicKey?: PublicKeyCredentialRequestOptions; + signal?: AbortSignal; +} + +export interface CustomEventInit extends EventInit { + detail?: T; +} + +export interface DOMMatrix2DInit { + a?: number; + b?: number; + c?: number; + d?: number; + e?: number; + f?: number; + m11?: number; + m12?: number; + m21?: number; + m22?: number; + m41?: number; + m42?: number; +} + +export interface DOMMatrixInit extends DOMMatrix2DInit { + is2D?: boolean; + m13?: number; + m14?: number; + m23?: number; + m24?: number; + m31?: number; + m32?: number; + m33?: number; + m34?: number; + m43?: number; + m44?: number; +} + +export interface DOMPointInit { + w?: number; + x?: number; + y?: number; + z?: number; +} + +export interface DOMQuadInit { + p1?: DOMPointInit; + p2?: DOMPointInit; + p3?: DOMPointInit; + p4?: DOMPointInit; +} + +export interface DOMRectInit { + height?: number; + width?: number; + x?: number; + y?: number; +} + +export interface DelayOptions extends AudioNodeOptions { + delayTime?: number; + maxDelayTime?: number; +} + +export interface DeviceLightEventInit extends EventInit { + value?: number; +} + +export interface DeviceMotionEventAccelerationInit { + x?: number | null; + y?: number | null; + z?: number | null; +} + +export interface DeviceMotionEventInit extends EventInit { + acceleration?: DeviceMotionEventAccelerationInit; + accelerationIncludingGravity?: DeviceMotionEventAccelerationInit; + interval?: number; + rotationRate?: DeviceMotionEventRotationRateInit; +} + +export interface DeviceMotionEventRotationRateInit { + alpha?: number | null; + beta?: number | null; + gamma?: number | null; +} + +export interface DeviceOrientationEventInit extends EventInit { + absolute?: boolean; + alpha?: number | null; + beta?: number | null; + gamma?: number | null; +} + +export interface DevicePermissionDescriptor extends PermissionDescriptor { + deviceId?: string; + name: "camera" | "microphone" | "speaker"; +} + +export interface DocumentTimelineOptions { + originTime?: number; +} + +export interface DoubleRange { + max?: number; + min?: number; +} + +export interface DragEventInit extends MouseEventInit { + dataTransfer?: DataTransfer | null; +} + +export interface DynamicsCompressorOptions extends AudioNodeOptions { + attack?: number; + knee?: number; + ratio?: number; + release?: number; + threshold?: number; +} + +export interface EcKeyAlgorithm extends KeyAlgorithm { + namedCurve: NamedCurve; +} + +export interface EcKeyGenParams extends Algorithm { + namedCurve: NamedCurve; +} + +export interface EcKeyImportParams extends Algorithm { + namedCurve: NamedCurve; +} + +export interface EcdhKeyDeriveParams extends Algorithm { + public: CryptoKey; +} + +export interface EcdsaParams extends Algorithm { + hash: HashAlgorithmIdentifier; +} + +export interface EffectTiming { + delay?: number; + direction?: PlaybackDirection; + duration?: number | string; + easing?: string; + endDelay?: number; + fill?: FillMode; + iterationStart?: number; + iterations?: number; +} + +export interface ElementCreationOptions { + is?: string; +} + +export interface ElementDefinitionOptions { + extends?: string; +} + +export interface ErrorEventInit extends EventInit { + colno?: number; + error?: any; + filename?: string; + lineno?: number; + message?: string; +} + +export interface EventInit { + bubbles?: boolean; + cancelable?: boolean; + composed?: boolean; +} + +export interface EventListenerOptions { + capture?: boolean; +} + +export interface EventModifierInit extends UIEventInit { + altKey?: boolean; + ctrlKey?: boolean; + metaKey?: boolean; + modifierAltGraph?: boolean; + modifierCapsLock?: boolean; + modifierFn?: boolean; + modifierFnLock?: boolean; + modifierHyper?: boolean; + modifierNumLock?: boolean; + modifierScrollLock?: boolean; + modifierSuper?: boolean; + modifierSymbol?: boolean; + modifierSymbolLock?: boolean; + shiftKey?: boolean; +} + +export interface EventSourceInit { + withCredentials?: boolean; +} + +export interface ExceptionInformation { + domain?: string | null; +} + +export interface FilePropertyBag extends BlobPropertyBag { + lastModified?: number; +} + +export interface FocusEventInit extends UIEventInit { + relatedTarget?: EventTarget | null; +} + +export interface FocusNavigationEventInit extends EventInit { + navigationReason?: string | null; + originHeight?: number; + originLeft?: number; + originTop?: number; + originWidth?: number; +} + +export interface FocusNavigationOrigin { + originHeight?: number; + originLeft?: number; + originTop?: number; + originWidth?: number; +} + +export interface FocusOptions { + preventScroll?: boolean; +} + +export interface FullscreenOptions { + navigationUI?: FullscreenNavigationUI; +} + +export interface GainOptions extends AudioNodeOptions { + gain?: number; +} + +export interface GamepadEventInit extends EventInit { + gamepad: Gamepad; +} + +export interface GetNotificationOptions { + tag?: string; +} + +export interface GetRootNodeOptions { + composed?: boolean; +} + +export interface HashChangeEventInit extends EventInit { + newURL?: string; + oldURL?: string; +} + +export interface HkdfParams extends Algorithm { + hash: HashAlgorithmIdentifier; + info: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer; + salt: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer; +} + +export interface HmacImportParams extends Algorithm { + hash: HashAlgorithmIdentifier; + length?: number; +} + +export interface HmacKeyAlgorithm extends KeyAlgorithm { + hash: KeyAlgorithm; + length: number; +} + +export interface HmacKeyGenParams extends Algorithm { + hash: HashAlgorithmIdentifier; + length?: number; +} + +export interface IDBIndexParameters { + multiEntry?: boolean; + unique?: boolean; +} + +export interface IDBObjectStoreParameters { + autoIncrement?: boolean; + keyPath?: string | string[] | null; +} + +export interface IDBVersionChangeEventInit extends EventInit { + newVersion?: number | null; + oldVersion?: number; +} + +export interface IIRFilterOptions extends AudioNodeOptions { + feedback: number[]; + feedforward: number[]; +} + +export interface ImageBitmapRenderingContextSettings { + alpha?: boolean; +} + +export interface ImageEncodeOptions { + quality?: number; + type?: string; +} + +export interface InputEventInit extends UIEventInit { + data?: string | null; + inputType?: string; + isComposing?: boolean; +} + +export interface IntersectionObserverEntryInit { + boundingClientRect: DOMRectInit; + intersectionRatio: number; + intersectionRect: DOMRectInit; + isIntersecting: boolean; + rootBounds: DOMRectInit | null; + target: Element; + time: number; +} + +export interface IntersectionObserverInit { + root?: Element | null; + rootMargin?: string; + threshold?: number | number[]; +} + +export interface JsonWebKey { + alg?: string; + crv?: string; + d?: string; + dp?: string; + dq?: string; + e?: string; + ext?: boolean; + k?: string; + key_ops?: string[]; + kty?: string; + n?: string; + oth?: RsaOtherPrimesInfo[]; + p?: string; + q?: string; + qi?: string; + use?: string; + x?: string; + y?: string; +} + +export interface KeyAlgorithm { + name: string; +} + +export interface KeyboardEventInit extends EventModifierInit { + code?: string; + isComposing?: boolean; + key?: string; + location?: number; + repeat?: boolean; +} + +export interface Keyframe { + composite?: CompositeOperationOrAuto; + easing?: string; + offset?: number | null; + [property: string]: string | number | null | undefined; +} + +export interface KeyframeAnimationOptions extends KeyframeEffectOptions { + id?: string; +} + +export interface KeyframeEffectOptions extends EffectTiming { + composite?: CompositeOperation; + iterationComposite?: IterationCompositeOperation; +} + +export interface MediaElementAudioSourceOptions { + mediaElement: HTMLMediaElement; +} + +export interface MediaEncryptedEventInit extends EventInit { + initData?: ArrayBuffer | null; + initDataType?: string; +} + +export interface MediaKeyMessageEventInit extends EventInit { + message: ArrayBuffer; + messageType: MediaKeyMessageType; +} + +export interface MediaKeySystemConfiguration { + audioCapabilities?: MediaKeySystemMediaCapability[]; + distinctiveIdentifier?: MediaKeysRequirement; + initDataTypes?: string[]; + label?: string; + persistentState?: MediaKeysRequirement; + sessionTypes?: string[]; + videoCapabilities?: MediaKeySystemMediaCapability[]; +} + +export interface MediaKeySystemMediaCapability { + contentType?: string; + robustness?: string; +} + +export interface MediaQueryListEventInit extends EventInit { + matches?: boolean; + media?: string; +} + +export interface MediaStreamAudioSourceOptions { + mediaStream: MediaStream; +} + +export interface MediaStreamConstraints { + audio?: boolean | MediaTrackConstraints; + peerIdentity?: string; + video?: boolean | MediaTrackConstraints; +} + +export interface MediaStreamErrorEventInit extends EventInit { + error?: MediaStreamError | null; +} + +export interface MediaStreamEventInit extends EventInit { + stream?: MediaStream; +} + +export interface MediaStreamTrackAudioSourceOptions { + mediaStreamTrack: MediaStreamTrack; +} + +export interface MediaStreamTrackEventInit extends EventInit { + track: MediaStreamTrack; +} + +export interface MediaTrackCapabilities { + aspectRatio?: DoubleRange; + autoGainControl?: boolean[]; + channelCount?: ULongRange; + deviceId?: string; + echoCancellation?: boolean[]; + facingMode?: string[]; + frameRate?: DoubleRange; + groupId?: string; + height?: ULongRange; + latency?: DoubleRange; + noiseSuppression?: boolean[]; + resizeMode?: string[]; + sampleRate?: ULongRange; + sampleSize?: ULongRange; + width?: ULongRange; +} + +export interface MediaTrackConstraintSet { + aspectRatio?: ConstrainDouble; + autoGainControl?: ConstrainBoolean; + channelCount?: ConstrainULong; + deviceId?: ConstrainDOMString; + echoCancellation?: ConstrainBoolean; + facingMode?: ConstrainDOMString; + frameRate?: ConstrainDouble; + groupId?: ConstrainDOMString; + height?: ConstrainULong; + latency?: ConstrainDouble; + noiseSuppression?: ConstrainBoolean; + resizeMode?: ConstrainDOMString; + sampleRate?: ConstrainULong; + sampleSize?: ConstrainULong; + width?: ConstrainULong; +} + +export interface MediaTrackConstraints extends MediaTrackConstraintSet { + advanced?: MediaTrackConstraintSet[]; +} + +export interface MediaTrackSettings { + aspectRatio?: number; + autoGainControl?: boolean; + channelCount?: number; + deviceId?: string; + echoCancellation?: boolean; + facingMode?: string; + frameRate?: number; + groupId?: string; + height?: number; + latency?: number; + noiseSuppression?: boolean; + resizeMode?: string; + sampleRate?: number; + sampleSize?: number; + width?: number; +} + +export interface MediaTrackSupportedConstraints { + aspectRatio?: boolean; + autoGainControl?: boolean; + channelCount?: boolean; + deviceId?: boolean; + echoCancellation?: boolean; + facingMode?: boolean; + frameRate?: boolean; + groupId?: boolean; + height?: boolean; + latency?: boolean; + noiseSuppression?: boolean; + resizeMode?: boolean; + sampleRate?: boolean; + sampleSize?: boolean; + width?: boolean; +} + +export interface MessageEventInit extends EventInit { + data?: any; + lastEventId?: string; + origin?: string; + ports?: MessagePort[]; + source?: MessageEventSource | null; +} + +export interface MidiPermissionDescriptor extends PermissionDescriptor { + name: "midi"; + sysex?: boolean; +} + +export interface MouseEventInit extends EventModifierInit { + button?: number; + buttons?: number; + clientX?: number; + clientY?: number; + movementX?: number; + movementY?: number; + relatedTarget?: EventTarget | null; + screenX?: number; + screenY?: number; +} + +export interface MultiCacheQueryOptions extends CacheQueryOptions { + cacheName?: string; +} + +export interface MutationObserverInit { + /** + * Set to a list of attribute local names (without namespace) if not all attribute mutations need to be observed and attributes is true or omitted. + */ + attributeFilter?: string[]; + /** + * Set to true if attributes is true or omitted and target's attribute value before the mutation needs to be recorded. + */ + attributeOldValue?: boolean; + /** + * Set to true if mutations to target's attributes are to be observed. Can be omitted if attributeOldValue or attributeFilter is specified. + */ + attributes?: boolean; + /** + * Set to true if mutations to target's data are to be observed. Can be omitted if characterDataOldValue is specified. + */ + characterData?: boolean; + /** + * Set to true if characterData is set to true or omitted and target's data before the mutation needs to be recorded. + */ + characterDataOldValue?: boolean; + /** + * Set to true if mutations to target's children are to be observed. + */ + childList?: boolean; + /** + * Set to true if mutations to not just target, but also target's descendants are to be observed. + */ + subtree?: boolean; +} + +export interface NavigationPreloadState { + enabled?: boolean; + headerValue?: string; +} + +export interface NotificationAction { + action: string; + icon?: string; + title: string; +} + +export interface NotificationOptions { + actions?: NotificationAction[]; + badge?: string; + body?: string; + data?: any; + dir?: NotificationDirection; + icon?: string; + image?: string; + lang?: string; + renotify?: boolean; + requireInteraction?: boolean; + silent?: boolean; + tag?: string; + timestamp?: number; + vibrate?: VibratePattern; +} + +export interface OfflineAudioCompletionEventInit extends EventInit { + renderedBuffer: AudioBuffer; +} + +export interface OfflineAudioContextOptions { + length: number; + numberOfChannels?: number; + sampleRate: number; +} + +export interface OptionalEffectTiming { + delay?: number; + direction?: PlaybackDirection; + duration?: number | string; + easing?: string; + endDelay?: number; + fill?: FillMode; + iterationStart?: number; + iterations?: number; +} + +export interface OscillatorOptions extends AudioNodeOptions { + detune?: number; + frequency?: number; + periodicWave?: PeriodicWave; + type?: OscillatorType; +} + +export interface PageTransitionEventInit extends EventInit { + persisted?: boolean; +} + +export interface PannerOptions extends AudioNodeOptions { + coneInnerAngle?: number; + coneOuterAngle?: number; + coneOuterGain?: number; + distanceModel?: DistanceModelType; + maxDistance?: number; + orientationX?: number; + orientationY?: number; + orientationZ?: number; + panningModel?: PanningModelType; + positionX?: number; + positionY?: number; + positionZ?: number; + refDistance?: number; + rolloffFactor?: number; +} + +export interface PaymentCurrencyAmount { + currency: string; + currencySystem?: string; + value: string; +} + +export interface PaymentDetailsBase { + displayItems?: PaymentItem[]; + modifiers?: PaymentDetailsModifier[]; + shippingOptions?: PaymentShippingOption[]; +} + +export interface PaymentDetailsInit extends PaymentDetailsBase { + id?: string; + total: PaymentItem; +} + +export interface PaymentDetailsModifier { + additionalDisplayItems?: PaymentItem[]; + data?: any; + supportedMethods: string | string[]; + total?: PaymentItem; +} + +export interface PaymentDetailsUpdate extends PaymentDetailsBase { + error?: string; + total?: PaymentItem; +} + +export interface PaymentItem { + amount: PaymentCurrencyAmount; + label: string; + pending?: boolean; +} + +export interface PaymentMethodData { + data?: any; + supportedMethods: string | string[]; +} + +export interface PaymentOptions { + requestPayerEmail?: boolean; + requestPayerName?: boolean; + requestPayerPhone?: boolean; + requestShipping?: boolean; + shippingType?: string; +} + +export interface PaymentRequestUpdateEventInit extends EventInit { +} + +export interface PaymentShippingOption { + amount: PaymentCurrencyAmount; + id: string; + label: string; + selected?: boolean; +} + +export interface Pbkdf2Params extends Algorithm { + hash: HashAlgorithmIdentifier; + iterations: number; + salt: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer; +} + +export interface PerformanceObserverInit { + buffered?: boolean; + entryTypes?: string[]; + type?: string; +} + +export interface PeriodicWaveConstraints { + disableNormalization?: boolean; +} + +export interface PeriodicWaveOptions extends PeriodicWaveConstraints { + imag?: number[] | Float32Array; + real?: number[] | Float32Array; +} + +export interface PermissionDescriptor { + name: PermissionName; +} + +export interface PipeOptions { + preventAbort?: boolean; + preventCancel?: boolean; + preventClose?: boolean; + signal?: AbortSignal; +} + +export interface PointerEventInit extends MouseEventInit { + height?: number; + isPrimary?: boolean; + pointerId?: number; + pointerType?: string; + pressure?: number; + tangentialPressure?: number; + tiltX?: number; + tiltY?: number; + twist?: number; + width?: number; +} + +export interface PopStateEventInit extends EventInit { + state?: any; +} + +export interface PositionOptions { + enableHighAccuracy?: boolean; + maximumAge?: number; + timeout?: number; +} + +export interface PostMessageOptions { + transfer?: any[]; +} + +export interface ProgressEventInit extends EventInit { + lengthComputable?: boolean; + loaded?: number; + total?: number; +} + +export interface PromiseRejectionEventInit extends EventInit { + promise: Promise; + reason?: any; +} + +export interface PropertyIndexedKeyframes { + composite?: CompositeOperationOrAuto | CompositeOperationOrAuto[]; + easing?: string | string[]; + offset?: number | (number | null)[]; + [property: string]: string | string[] | number | null | (number | null)[] | undefined; +} + +export interface PublicKeyCredentialCreationOptions { + attestation?: AttestationConveyancePreference; + authenticatorSelection?: AuthenticatorSelectionCriteria; + challenge: BufferSource; + excludeCredentials?: PublicKeyCredentialDescriptor[]; + extensions?: AuthenticationExtensionsClientInputs; + pubKeyCredParams: PublicKeyCredentialParameters[]; + rp: PublicKeyCredentialRpEntity; + timeout?: number; + user: PublicKeyCredentialUserEntity; +} + +export interface PublicKeyCredentialDescriptor { + id: BufferSource; + transports?: AuthenticatorTransport[]; + type: PublicKeyCredentialType; +} + +export interface PublicKeyCredentialEntity { + icon?: string; + name: string; +} + +export interface PublicKeyCredentialParameters { + alg: COSEAlgorithmIdentifier; + type: PublicKeyCredentialType; +} + +export interface PublicKeyCredentialRequestOptions { + allowCredentials?: PublicKeyCredentialDescriptor[]; + challenge: BufferSource; + extensions?: AuthenticationExtensionsClientInputs; + rpId?: string; + timeout?: number; + userVerification?: UserVerificationRequirement; +} + +export interface PublicKeyCredentialRpEntity extends PublicKeyCredentialEntity { + id?: string; +} + +export interface PublicKeyCredentialUserEntity extends PublicKeyCredentialEntity { + displayName: string; + id: BufferSource; +} + +export interface PushPermissionDescriptor extends PermissionDescriptor { + name: "push"; + userVisibleOnly?: boolean; +} + +export interface PushSubscriptionJSON { + endpoint?: string; + expirationTime?: number | null; + keys?: Record; +} + +export interface PushSubscriptionOptionsInit { + applicationServerKey?: BufferSource | string | null; + userVisibleOnly?: boolean; +} + +export interface QueuingStrategy { + highWaterMark?: number; + size?: QueuingStrategySizeCallback; +} + +export interface RTCAnswerOptions extends RTCOfferAnswerOptions { +} + +export interface RTCCertificateExpiration { + expires?: number; +} + +export interface RTCConfiguration { + bundlePolicy?: RTCBundlePolicy; + certificates?: RTCCertificate[]; + iceCandidatePoolSize?: number; + iceServers?: RTCIceServer[]; + iceTransportPolicy?: RTCIceTransportPolicy; + peerIdentity?: string; + rtcpMuxPolicy?: RTCRtcpMuxPolicy; +} + +export interface RTCDTMFToneChangeEventInit extends EventInit { + tone: string; +} + +export interface RTCDataChannelEventInit extends EventInit { + channel: RTCDataChannel; +} + +export interface RTCDataChannelInit { + id?: number; + maxPacketLifeTime?: number; + maxRetransmits?: number; + negotiated?: boolean; + ordered?: boolean; + priority?: RTCPriorityType; + protocol?: string; +} + +export interface RTCDtlsFingerprint { + algorithm?: string; + value?: string; +} + +export interface RTCDtlsParameters { + fingerprints?: RTCDtlsFingerprint[]; + role?: RTCDtlsRole; +} + +export interface RTCErrorEventInit extends EventInit { + error: RTCError; +} + +export interface RTCErrorInit { + errorDetail: RTCErrorDetailType; + httpRequestStatusCode?: number; + receivedAlert?: number; + sctpCauseCode?: number; + sdpLineNumber?: number; + sentAlert?: number; +} + +export interface RTCIceCandidateAttributes extends RTCStats { + addressSourceUrl?: string; + candidateType?: RTCStatsIceCandidateType; + ipAddress?: string; + portNumber?: number; + priority?: number; + transport?: string; +} + +export interface RTCIceCandidateComplete { +} + +export interface RTCIceCandidateDictionary { + foundation?: string; + ip?: string; + msMTurnSessionId?: string; + port?: number; + priority?: number; + protocol?: RTCIceProtocol; + relatedAddress?: string; + relatedPort?: number; + tcpType?: RTCIceTcpCandidateType; + type?: RTCIceCandidateType; +} + +export interface RTCIceCandidateInit { + candidate?: string; + sdpMLineIndex?: number | null; + sdpMid?: string | null; + usernameFragment?: string | null; +} + +export interface RTCIceCandidatePair { + local?: RTCIceCandidate; + remote?: RTCIceCandidate; +} + +export interface RTCIceCandidatePairStats extends RTCStats { + availableIncomingBitrate?: number; + availableOutgoingBitrate?: number; + bytesReceived?: number; + bytesSent?: number; + localCandidateId?: string; + nominated?: boolean; + priority?: number; + readable?: boolean; + remoteCandidateId?: string; + roundTripTime?: number; + state?: RTCStatsIceCandidatePairState; + transportId?: string; + writable?: boolean; +} + +export interface RTCIceGatherOptions { + gatherPolicy?: RTCIceGatherPolicy; + iceservers?: RTCIceServer[]; +} + +export interface RTCIceParameters { + password?: string; + usernameFragment?: string; +} + +export interface RTCIceServer { + credential?: string | RTCOAuthCredential; + credentialType?: RTCIceCredentialType; + urls: string | string[]; + username?: string; +} + +export interface RTCIdentityProviderOptions { + peerIdentity?: string; + protocol?: string; + usernameHint?: string; +} + +export interface RTCInboundRTPStreamStats extends RTCRTPStreamStats { + bytesReceived?: number; + fractionLost?: number; + jitter?: number; + packetsLost?: number; + packetsReceived?: number; +} + +export interface RTCMediaStreamTrackStats extends RTCStats { + audioLevel?: number; + echoReturnLoss?: number; + echoReturnLossEnhancement?: number; + frameHeight?: number; + frameWidth?: number; + framesCorrupted?: number; + framesDecoded?: number; + framesDropped?: number; + framesPerSecond?: number; + framesReceived?: number; + framesSent?: number; + remoteSource?: boolean; + ssrcIds?: string[]; + trackIdentifier?: string; +} + +export interface RTCOAuthCredential { + accessToken: string; + macKey: string; +} + +export interface RTCOfferAnswerOptions { + voiceActivityDetection?: boolean; +} + +export interface RTCOfferOptions extends RTCOfferAnswerOptions { + iceRestart?: boolean; + offerToReceiveAudio?: boolean; + offerToReceiveVideo?: boolean; +} + +export interface RTCOutboundRTPStreamStats extends RTCRTPStreamStats { + bytesSent?: number; + packetsSent?: number; + roundTripTime?: number; + targetBitrate?: number; +} + +export interface RTCPeerConnectionIceErrorEventInit extends EventInit { + errorCode: number; + hostCandidate?: string; + statusText?: string; + url?: string; +} + +export interface RTCPeerConnectionIceEventInit extends EventInit { + candidate?: RTCIceCandidate | null; + url?: string | null; +} + +export interface RTCRTPStreamStats extends RTCStats { + associateStatsId?: string; + codecId?: string; + firCount?: number; + isRemote?: boolean; + mediaTrackId?: string; + mediaType?: string; + nackCount?: number; + pliCount?: number; + sliCount?: number; + ssrc?: string; + transportId?: string; +} + +export interface RTCRtcpFeedback { + parameter?: string; + type?: string; +} + +export interface RTCRtcpParameters { + cname?: string; + reducedSize?: boolean; +} + +export interface RTCRtpCapabilities { + codecs: RTCRtpCodecCapability[]; + headerExtensions: RTCRtpHeaderExtensionCapability[]; +} + +export interface RTCRtpCodecCapability { + channels?: number; + clockRate: number; + mimeType: string; + sdpFmtpLine?: string; +} + +export interface RTCRtpCodecParameters { + channels?: number; + clockRate: number; + mimeType: string; + payloadType: number; + sdpFmtpLine?: string; +} + +export interface RTCRtpCodingParameters { + rid?: string; +} + +export interface RTCRtpContributingSource { + audioLevel?: number; + rtpTimestamp: number; + source: number; + timestamp: number; +} + +export interface RTCRtpDecodingParameters extends RTCRtpCodingParameters { +} + +export interface RTCRtpEncodingParameters extends RTCRtpCodingParameters { + active?: boolean; + codecPayloadType?: number; + dtx?: RTCDtxStatus; + maxBitrate?: number; + maxFramerate?: number; + ptime?: number; + scaleResolutionDownBy?: number; +} + +export interface RTCRtpFecParameters { + mechanism?: string; + ssrc?: number; +} + +export interface RTCRtpHeaderExtension { + kind?: string; + preferredEncrypt?: boolean; + preferredId?: number; + uri?: string; +} + +export interface RTCRtpHeaderExtensionCapability { + uri?: string; +} + +export interface RTCRtpHeaderExtensionParameters { + encrypted?: boolean; + id: number; + uri: string; +} + +export interface RTCRtpParameters { + codecs: RTCRtpCodecParameters[]; + headerExtensions: RTCRtpHeaderExtensionParameters[]; + rtcp: RTCRtcpParameters; +} + +export interface RTCRtpReceiveParameters extends RTCRtpParameters { + encodings: RTCRtpDecodingParameters[]; +} + +export interface RTCRtpRtxParameters { + ssrc?: number; +} + +export interface RTCRtpSendParameters extends RTCRtpParameters { + degradationPreference?: RTCDegradationPreference; + encodings: RTCRtpEncodingParameters[]; + priority?: RTCPriorityType; + transactionId: string; +} + +export interface RTCRtpSynchronizationSource extends RTCRtpContributingSource { + voiceActivityFlag?: boolean; +} + +export interface RTCRtpTransceiverInit { + direction?: RTCRtpTransceiverDirection; + sendEncodings?: RTCRtpEncodingParameters[]; + streams?: MediaStream[]; +} + +export interface RTCRtpUnhandled { + muxId?: string; + payloadType?: number; + ssrc?: number; +} + +export interface RTCSessionDescriptionInit { + sdp?: string; + type?: RTCSdpType; +} + +export interface RTCSrtpKeyParam { + keyMethod?: string; + keySalt?: string; + lifetime?: string; + mkiLength?: number; + mkiValue?: number; +} + +export interface RTCSrtpSdesParameters { + cryptoSuite?: string; + keyParams?: RTCSrtpKeyParam[]; + sessionParams?: string[]; + tag?: number; +} + +export interface RTCSsrcRange { + max?: number; + min?: number; +} + +export interface RTCStats { + id: string; + timestamp: number; + type: RTCStatsType; +} + +export interface RTCStatsEventInit extends EventInit { + report: RTCStatsReport; +} + +export interface RTCStatsReport { +} + +export interface RTCTrackEventInit extends EventInit { + receiver: RTCRtpReceiver; + streams?: MediaStream[]; + track: MediaStreamTrack; + transceiver: RTCRtpTransceiver; +} + +export interface RTCTransportStats extends RTCStats { + activeConnection?: boolean; + bytesReceived?: number; + bytesSent?: number; + localCertificateId?: string; + remoteCertificateId?: string; + rtcpTransportStatsId?: string; + selectedCandidatePairId?: string; +} + +export interface ReadableStreamReadDoneResult { + done: true; + value?: T; +} + +export interface ReadableStreamReadValueResult { + done: false; + value: T; +} + +export interface RegistrationOptions { + scope?: string; + type?: WorkerType; + updateViaCache?: ServiceWorkerUpdateViaCache; +} + +export interface RequestInit { + /** + * A BodyInit object or null to set request's body. + */ + body?: BodyInit | null; + /** + * A string indicating how the request will interact with the browser's cache to set request's cache. + */ + cache?: RequestCache; + /** + * A string indicating whether credentials will be sent with the request always, never, or only when sent to a same-origin URL. Sets request's credentials. + */ + credentials?: RequestCredentials; + /** + * A Headers object, an object literal, or an array of two-item arrays to set request's headers. + */ + headers?: HeadersInit; + /** + * A cryptographic hash of the resource to be fetched by request. Sets request's integrity. + */ + integrity?: string; + /** + * A boolean to set request's keepalive. + */ + keepalive?: boolean; + /** + * A string to set request's method. + */ + method?: string; + /** + * A string to indicate whether the request will use CORS, or will be restricted to same-origin URLs. Sets request's mode. + */ + mode?: RequestMode; + /** + * A string indicating whether request follows redirects, results in an error upon encountering a redirect, or returns the redirect (in an opaque fashion). Sets request's redirect. + */ + redirect?: RequestRedirect; + /** + * A string whose value is a same-origin URL, "about:client", or the empty string, to set request's referrer. + */ + referrer?: string; + /** + * A referrer policy to set request's referrerPolicy. + */ + referrerPolicy?: ReferrerPolicy; + /** + * An AbortSignal to set request's signal. + */ + signal?: AbortSignal | null; + /** + * Can only be null. Used to disassociate request from any Window. + */ + window?: any; +} + +export interface ResponseInit { + headers?: HeadersInit; + status?: number; + statusText?: string; +} + +export interface RsaHashedImportParams extends Algorithm { + hash: HashAlgorithmIdentifier; +} + +export interface RsaHashedKeyAlgorithm extends RsaKeyAlgorithm { + hash: KeyAlgorithm; +} + +export interface RsaHashedKeyGenParams extends RsaKeyGenParams { + hash: HashAlgorithmIdentifier; +} + +export interface RsaKeyAlgorithm extends KeyAlgorithm { + modulusLength: number; + publicExponent: BigInteger; +} + +export interface RsaKeyGenParams extends Algorithm { + modulusLength: number; + publicExponent: BigInteger; +} + +export interface RsaOaepParams extends Algorithm { + label?: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer; +} + +export interface RsaOtherPrimesInfo { + d?: string; + r?: string; + t?: string; +} + +export interface RsaPssParams extends Algorithm { + saltLength: number; +} + +export interface SVGBoundingBoxOptions { + clipped?: boolean; + fill?: boolean; + markers?: boolean; + stroke?: boolean; +} + +export interface ScopedCredentialDescriptor { + id: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer | null; + transports?: Transport[]; + type: ScopedCredentialType; +} + +export interface ScopedCredentialOptions { + excludeList?: ScopedCredentialDescriptor[]; + extensions?: WebAuthnExtensions; + rpId?: string; + timeoutSeconds?: number; +} + +export interface ScopedCredentialParameters { + algorithm: string | Algorithm; + type: ScopedCredentialType; +} + +export interface ScrollIntoViewOptions extends ScrollOptions { + block?: ScrollLogicalPosition; + inline?: ScrollLogicalPosition; +} + +export interface ScrollOptions { + behavior?: ScrollBehavior; +} + +export interface ScrollToOptions extends ScrollOptions { + left?: number; + top?: number; +} + +export interface SecurityPolicyViolationEventInit extends EventInit { + blockedURI?: string; + columnNumber?: number; + documentURI?: string; + effectiveDirective?: string; + lineNumber?: number; + originalPolicy?: string; + referrer?: string; + sourceFile?: string; + statusCode?: number; + violatedDirective?: string; +} + +export interface ServiceWorkerMessageEventInit extends EventInit { + data?: any; + lastEventId?: string; + origin?: string; + ports?: MessagePort[] | null; + source?: ServiceWorker | MessagePort | null; +} + +export interface ShadowRootInit { + delegatesFocus?: boolean; + mode: ShadowRootMode; +} + +export interface SpeechSynthesisErrorEventInit extends SpeechSynthesisEventInit { + error: SpeechSynthesisErrorCode; +} + +export interface SpeechSynthesisEventInit extends EventInit { + charIndex?: number; + charLength?: number; + elapsedTime?: number; + name?: string; + utterance: SpeechSynthesisUtterance; +} + +export interface StaticRangeInit { + endContainer: Node; + endOffset: number; + startContainer: Node; + startOffset: number; +} + +export interface StereoPannerOptions extends AudioNodeOptions { + pan?: number; +} + +export interface StorageEstimate { + quota?: number; + usage?: number; +} + +export interface StorageEventInit extends EventInit { + key?: string | null; + newValue?: string | null; + oldValue?: string | null; + storageArea?: Storage | null; + url?: string; +} + +export interface StoreExceptionsInformation extends ExceptionInformation { + detailURI?: string | null; + explanationString?: string | null; + siteName?: string | null; +} + +export interface StoreSiteSpecificExceptionsInformation extends StoreExceptionsInformation { + arrayOfDomainStrings?: string[]; +} + +export interface TextDecodeOptions { + stream?: boolean; +} + +export interface TextDecoderOptions { + fatal?: boolean; + ignoreBOM?: boolean; +} + +export interface TextEncoderEncodeIntoResult { + read?: number; + written?: number; +} + +export interface TouchEventInit extends EventModifierInit { + changedTouches?: Touch[]; + targetTouches?: Touch[]; + touches?: Touch[]; +} + +export interface TouchInit { + altitudeAngle?: number; + azimuthAngle?: number; + clientX?: number; + clientY?: number; + force?: number; + identifier: number; + pageX?: number; + pageY?: number; + radiusX?: number; + radiusY?: number; + rotationAngle?: number; + screenX?: number; + screenY?: number; + target: EventTarget; + touchType?: TouchType; +} + +export interface TrackEventInit extends EventInit { + track?: VideoTrack | AudioTrack | TextTrack | null; +} + +export interface Transformer { + flush?: TransformStreamDefaultControllerCallback; + readableType?: undefined; + start?: TransformStreamDefaultControllerCallback; + transform?: TransformStreamDefaultControllerTransformCallback; + writableType?: undefined; +} + +export interface TransitionEventInit extends EventInit { + elapsedTime?: number; + propertyName?: string; + pseudoElement?: string; +} + +export interface UIEventInit extends EventInit { + detail?: number; + view?: Window | null; +} + +export interface ULongRange { + max?: number; + min?: number; +} + +export interface UnderlyingByteSource { + autoAllocateChunkSize?: number; + cancel?: ReadableStreamErrorCallback; + pull?: ReadableByteStreamControllerCallback; + start?: ReadableByteStreamControllerCallback; + type: "bytes"; +} + +export interface UnderlyingSink { + abort?: WritableStreamErrorCallback; + close?: WritableStreamDefaultControllerCloseCallback; + start?: WritableStreamDefaultControllerStartCallback; + type?: undefined; + write?: WritableStreamDefaultControllerWriteCallback; +} + +export interface UnderlyingSource { + cancel?: ReadableStreamErrorCallback; + pull?: ReadableStreamDefaultControllerCallback; + start?: ReadableStreamDefaultControllerCallback; + type?: undefined; +} + +export interface VRDisplayEventInit extends EventInit { + display: VRDisplay; + reason?: VRDisplayEventReason; +} + +export interface VRLayer { + leftBounds?: number[] | Float32Array | null; + rightBounds?: number[] | Float32Array | null; + source?: HTMLCanvasElement | null; +} + +export interface VRStageParameters { + sittingToStandingTransform?: Float32Array; + sizeX?: number; + sizeY?: number; +} + +export interface WaveShaperOptions extends AudioNodeOptions { + curve?: number[] | Float32Array; + oversample?: OverSampleType; +} + +export interface WebAuthnExtensions { +} + +export interface WebGLContextAttributes { + alpha?: boolean; + antialias?: boolean; + depth?: boolean; + desynchronized?: boolean; + failIfMajorPerformanceCaveat?: boolean; + powerPreference?: WebGLPowerPreference; + premultipliedAlpha?: boolean; + preserveDrawingBuffer?: boolean; + stencil?: boolean; +} + +export interface WebGLContextEventInit extends EventInit { + statusMessage?: string; +} + +export interface WheelEventInit extends MouseEventInit { + deltaMode?: number; + deltaX?: number; + deltaY?: number; + deltaZ?: number; +} + +export interface WorkerOptions { + credentials?: RequestCredentials; + name?: string; + type?: WorkerType; +} + +export interface WorkletOptions { + credentials?: RequestCredentials; +} + +export interface txAuthGenericArg { + content: ArrayBuffer; + contentType: string; +} + +export interface EventListener { + (evt: Event): void; +} + +export type XPathNSResolver = ((prefix: string | null) => string | null) | { lookupNamespaceURI(prefix: string | null): string | null; }; + +/** The ANGLE_instanced_arrays extension is part of the WebGL API and allows to draw the same object, or groups of similar objects multiple times, if they share the same vertex data, primitive count and type. */ +export interface ANGLE_instanced_arrays { + drawArraysInstancedANGLE(mode: GLenum, first: GLint, count: GLsizei, primcount: GLsizei): void; + drawElementsInstancedANGLE(mode: GLenum, count: GLsizei, type: GLenum, offset: GLintptr, primcount: GLsizei): void; + vertexAttribDivisorANGLE(index: GLuint, divisor: GLuint): void; + readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: GLenum; +} + +/** A controller object that allows you to abort one or more DOM requests as and when desired. */ +export interface AbortController { + /** + * Returns the AbortSignal object associated with this object. + */ + readonly signal: AbortSignal; + /** + * Invoking this method will set this object's AbortSignal's aborted flag and signal to any observers that the associated activity is to be aborted. + */ + abort(): void; +} + + +export interface AbortSignalEventMap { + "abort": Event; +} + +/** A signal object that allows you to communicate with a DOM request (such as a Fetch) and abort it if required via an AbortController object. */ +export interface AbortSignal extends EventTarget { + /** + * Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise. + */ + readonly aborted: boolean; + onabort: ((this: AbortSignal, ev: Event) => any) | null; + addEventListener(type: K, listener: (this: AbortSignal, ev: AbortSignalEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: AbortSignal, ev: AbortSignalEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + + +export interface AbstractRange { + /** + * Returns true if range is collapsed, and false otherwise. + */ + readonly collapsed: boolean; + /** + * Returns range's end node. + */ + readonly endContainer: Node; + /** + * Returns range's end offset. + */ + readonly endOffset: number; + /** + * Returns range's start node. + */ + readonly startContainer: Node; + /** + * Returns range's start offset. + */ + readonly startOffset: number; +} + + +export interface AbstractWorkerEventMap { + "error": ErrorEvent; +} + +export interface AbstractWorker { + onerror: ((this: AbstractWorker, ev: ErrorEvent) => any) | null; + addEventListener(type: K, listener: (this: AbstractWorker, ev: AbstractWorkerEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: AbstractWorker, ev: AbstractWorkerEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +export interface AesCfbParams extends Algorithm { + iv: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer; +} + +export interface AesCmacParams extends Algorithm { + length: number; +} + +/** A node able to provide real-time frequency and time-domain analysis information. It is an AudioNode that passes the audio stream unchanged from the input to the output, but allows you to take the generated data, process it, and create audio visualizations. */ +export interface AnalyserNode extends AudioNode { + fftSize: number; + readonly frequencyBinCount: number; + maxDecibels: number; + minDecibels: number; + smoothingTimeConstant: number; + getByteFrequencyData(array: Uint8Array): void; + getByteTimeDomainData(array: Uint8Array): void; + getFloatFrequencyData(array: Float32Array): void; + getFloatTimeDomainData(array: Float32Array): void; +} + + +export interface Animatable { + animate(keyframes: Keyframe[] | PropertyIndexedKeyframes | null, options?: number | KeyframeAnimationOptions): Animation; + getAnimations(): Animation[]; +} + +export interface AnimationEventMap { + "cancel": AnimationPlaybackEvent; + "finish": AnimationPlaybackEvent; +} + +export interface Animation extends EventTarget { + currentTime: number | null; + effect: AnimationEffect | null; + readonly finished: Promise; + id: string; + oncancel: ((this: Animation, ev: AnimationPlaybackEvent) => any) | null; + onfinish: ((this: Animation, ev: AnimationPlaybackEvent) => any) | null; + readonly pending: boolean; + readonly playState: AnimationPlayState; + playbackRate: number; + readonly ready: Promise; + startTime: number | null; + timeline: AnimationTimeline | null; + cancel(): void; + finish(): void; + pause(): void; + play(): void; + reverse(): void; + updatePlaybackRate(playbackRate: number): void; + addEventListener(type: K, listener: (this: Animation, ev: AnimationEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: Animation, ev: AnimationEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + + +export interface AnimationEffect { + getComputedTiming(): ComputedEffectTiming; + getTiming(): EffectTiming; + updateTiming(timing?: OptionalEffectTiming): void; +} + + +/** Events providing information related to animations. */ +export interface AnimationEvent extends Event { + readonly animationName: string; + readonly elapsedTime: number; + readonly pseudoElement: string; +} + + +export interface AnimationFrameProvider { + cancelAnimationFrame(handle: number): void; + requestAnimationFrame(callback: FrameRequestCallback): number; +} + +export interface AnimationPlaybackEvent extends Event { + readonly currentTime: number | null; + readonly timelineTime: number | null; +} + + +export interface AnimationTimeline { + readonly currentTime: number | null; +} + + +export interface ApplicationCacheEventMap { + "cached": Event; + "checking": Event; + "downloading": Event; + "error": Event; + "noupdate": Event; + "obsolete": Event; + "progress": ProgressEvent; + "updateready": Event; +} + +export interface ApplicationCache extends EventTarget { + /** @deprecated */ + oncached: ((this: ApplicationCache, ev: Event) => any) | null; + /** @deprecated */ + onchecking: ((this: ApplicationCache, ev: Event) => any) | null; + /** @deprecated */ + ondownloading: ((this: ApplicationCache, ev: Event) => any) | null; + /** @deprecated */ + onerror: ((this: ApplicationCache, ev: Event) => any) | null; + /** @deprecated */ + onnoupdate: ((this: ApplicationCache, ev: Event) => any) | null; + /** @deprecated */ + onobsolete: ((this: ApplicationCache, ev: Event) => any) | null; + /** @deprecated */ + onprogress: ((this: ApplicationCache, ev: ProgressEvent) => any) | null; + /** @deprecated */ + onupdateready: ((this: ApplicationCache, ev: Event) => any) | null; + /** @deprecated */ + readonly status: number; + /** @deprecated */ + abort(): void; + /** @deprecated */ + swapCache(): void; + /** @deprecated */ + update(): void; + readonly CHECKING: number; + readonly DOWNLOADING: number; + readonly IDLE: number; + readonly OBSOLETE: number; + readonly UNCACHED: number; + readonly UPDATEREADY: number; + addEventListener(type: K, listener: (this: ApplicationCache, ev: ApplicationCacheEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: ApplicationCache, ev: ApplicationCacheEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + + +/** A DOM element's attribute as an object. In most DOM methods, you will probably directly retrieve the attribute as a string (e.g., Element.getAttribute(), but certain functions (e.g., Element.getAttributeNode()) or means of iterating give Attr types. */ +export interface Attr extends Node { + readonly localName: string; + readonly name: string; + readonly namespaceURI: string | null; + readonly ownerElement: Element | null; + readonly prefix: string | null; + readonly specified: boolean; + value: string; +} + + +/** A short audio asset residing in memory, created from an audio file using the AudioContext.decodeAudioData() method, or from raw data using AudioContext.createBuffer(). Once put into an AudioBuffer, the audio can then be played by being passed into an AudioBufferSourceNode. */ +export interface AudioBuffer { + readonly duration: number; + readonly length: number; + readonly numberOfChannels: number; + readonly sampleRate: number; + copyFromChannel(destination: Float32Array, channelNumber: number, bufferOffset?: number): void; + copyToChannel(source: Float32Array, channelNumber: number, bufferOffset?: number): void; + getChannelData(channel: number): Float32Array; +} + + +/** An AudioScheduledSourceNode which represents an audio source consisting of in-memory audio data, stored in an AudioBuffer. It's especially useful for playing back audio which has particularly stringent timing accuracy requirements, such as for sounds that must match a specific rhythm and can be kept in memory rather than being played from disk or the network. */ +export interface AudioBufferSourceNode extends AudioScheduledSourceNode { + buffer: AudioBuffer | null; + readonly detune: AudioParam; + loop: boolean; + loopEnd: number; + loopStart: number; + readonly playbackRate: AudioParam; + start(when?: number, offset?: number, duration?: number): void; + addEventListener(type: K, listener: (this: AudioBufferSourceNode, ev: AudioScheduledSourceNodeEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: AudioBufferSourceNode, ev: AudioScheduledSourceNodeEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + + +/** An audio-processing graph built from audio modules linked together, each represented by an AudioNode. */ +export interface AudioContext extends BaseAudioContext { + readonly baseLatency: number; + readonly outputLatency: number; + close(): Promise; + createMediaElementSource(mediaElement: HTMLMediaElement): MediaElementAudioSourceNode; + createMediaStreamDestination(): MediaStreamAudioDestinationNode; + createMediaStreamSource(mediaStream: MediaStream): MediaStreamAudioSourceNode; + createMediaStreamTrackSource(mediaStreamTrack: MediaStreamTrack): MediaStreamTrackAudioSourceNode; + getOutputTimestamp(): AudioTimestamp; + resume(): Promise; + suspend(): Promise; + addEventListener(type: K, listener: (this: AudioContext, ev: BaseAudioContextEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: AudioContext, ev: BaseAudioContextEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + + +/** AudioDestinationNode has no output (as it is the output, no more AudioNode can be linked after it in the audio graph) and one input. The number of channels in the input must be between 0 and the maxChannelCount value or an exception is raised. */ +export interface AudioDestinationNode extends AudioNode { + readonly maxChannelCount: number; +} + + +/** The position and orientation of the unique person listening to the audio scene, and is used in audio spatialization. All PannerNodes spatialize in relation to the AudioListener stored in the BaseAudioContext.listener attribute. */ +export interface AudioListener { + readonly forwardX: AudioParam; + readonly forwardY: AudioParam; + readonly forwardZ: AudioParam; + readonly positionX: AudioParam; + readonly positionY: AudioParam; + readonly positionZ: AudioParam; + readonly upX: AudioParam; + readonly upY: AudioParam; + readonly upZ: AudioParam; + /** @deprecated */ + setOrientation(x: number, y: number, z: number, xUp: number, yUp: number, zUp: number): void; + /** @deprecated */ + setPosition(x: number, y: number, z: number): void; +} + + +/** A generic interface for representing an audio processing module. Examples include: */ +export interface AudioNode extends EventTarget { + channelCount: number; + channelCountMode: ChannelCountMode; + channelInterpretation: ChannelInterpretation; + readonly context: BaseAudioContext; + readonly numberOfInputs: number; + readonly numberOfOutputs: number; + connect(destinationNode: AudioNode, output?: number, input?: number): AudioNode; + connect(destinationParam: AudioParam, output?: number): void; + disconnect(): void; + disconnect(output: number): void; + disconnect(destinationNode: AudioNode): void; + disconnect(destinationNode: AudioNode, output: number): void; + disconnect(destinationNode: AudioNode, output: number, input: number): void; + disconnect(destinationParam: AudioParam): void; + disconnect(destinationParam: AudioParam, output: number): void; +} + + +/** The Web Audio API's AudioParam interface represents an audio-related parameter, usually a parameter of an AudioNode (such as GainNode.gain). */ +export interface AudioParam { + automationRate: AutomationRate; + readonly defaultValue: number; + readonly maxValue: number; + readonly minValue: number; + value: number; + cancelAndHoldAtTime(cancelTime: number): AudioParam; + cancelScheduledValues(cancelTime: number): AudioParam; + exponentialRampToValueAtTime(value: number, endTime: number): AudioParam; + linearRampToValueAtTime(value: number, endTime: number): AudioParam; + setTargetAtTime(target: number, startTime: number, timeConstant: number): AudioParam; + setValueAtTime(value: number, startTime: number): AudioParam; + setValueCurveAtTime(values: number[] | Float32Array, startTime: number, duration: number): AudioParam; +} + + +export interface AudioParamMap { + forEach(callbackfn: (value: AudioParam, key: string, parent: AudioParamMap) => void, thisArg?: any): void; +} + + +/** The Web Audio API events that occur when a ScriptProcessorNode input buffer is ready to be processed. */ +export interface AudioProcessingEvent extends Event { + readonly inputBuffer: AudioBuffer; + readonly outputBuffer: AudioBuffer; + readonly playbackTime: number; +} + + +export interface AudioScheduledSourceNodeEventMap { + "ended": Event; +} + +export interface AudioScheduledSourceNode extends AudioNode { + onended: ((this: AudioScheduledSourceNode, ev: Event) => any) | null; + start(when?: number): void; + stop(when?: number): void; + addEventListener(type: K, listener: (this: AudioScheduledSourceNode, ev: AudioScheduledSourceNodeEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: AudioScheduledSourceNode, ev: AudioScheduledSourceNodeEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + + +/** A single audio track from one of the HTML media elements,