diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2020-07-23 10:27:26 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-23 16:27:26 +0200 |
commit | ca4dcb36dd5be0b14a2fafa059ea02ee7e0a0262 (patch) | |
tree | 393fc85f19e97bb66402676f67e63690d7a29e00 /cli/js2/03_dom_iterable.js | |
parent | 090455936c892b6f2dfa425be9b1cdfb4c63af4a (diff) |
Rename cli/js2 to cli/rt (#6857)
Diffstat (limited to 'cli/js2/03_dom_iterable.js')
-rw-r--r-- | cli/js2/03_dom_iterable.js | 77 |
1 files changed, 0 insertions, 77 deletions
diff --git a/cli/js2/03_dom_iterable.js b/cli/js2/03_dom_iterable.js deleted file mode 100644 index cd190b9cd..000000000 --- a/cli/js2/03_dom_iterable.js +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. - -((window) => { - const { requiredArguments } = window.__bootstrap.webUtil; - const { exposeForTest } = window.__bootstrap.internals; - - function DomIterableMixin( - Base, - dataSymbol, - ) { - // we have to cast `this` as `any` because there is no way to describe the - // Base class in a way where the Symbol `dataSymbol` is defined. So the - // runtime code works, but we do lose a little bit of type safety. - - // Additionally, we have to not use .keys() nor .values() since the internal - // slot differs in type - some have a Map, which yields [K, V] in - // Symbol.iterator, and some have an Array, which yields V, in this case - // [K, V] too as they are arrays of tuples. - - const DomIterable = class extends Base { - *entries() { - for (const entry of this[dataSymbol]) { - yield entry; - } - } - - *keys() { - for (const [key] of this[dataSymbol]) { - yield key; - } - } - - *values() { - for (const [, value] of this[dataSymbol]) { - yield value; - } - } - - forEach( - callbackfn, - thisArg, - ) { - requiredArguments( - `${this.constructor.name}.forEach`, - arguments.length, - 1, - ); - callbackfn = callbackfn.bind( - thisArg == null ? globalThis : Object(thisArg), - ); - for (const [key, value] of this[dataSymbol]) { - callbackfn(value, key, this); - } - } - - *[Symbol.iterator]() { - for (const entry of this[dataSymbol]) { - yield entry; - } - } - }; - - // we want the Base class name to be the name of the class. - Object.defineProperty(DomIterable, "name", { - value: Base.name, - configurable: true, - }); - - return DomIterable; - } - - exposeForTest("DomIterableMixin", DomIterableMixin); - - window.__bootstrap.domIterable = { - DomIterableMixin, - }; -})(this); |