Last active
March 7, 2020 13:59
-
-
Save petamoriken/bb99ca136bc663d3c6ac to your computer and use it in GitHub Desktop.
EventTarget constructor が使えないときに無理矢理 EventTarget クラスを作るコード。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyEventTarget extends DocumentFragment { | |
constructor() { | |
super(); | |
Object.setPrototypeOf(this, EventTarget.prototype); | |
} | |
static [Symbol.hasInstance](instance) { | |
return instance instanceof EventTarget; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Worker 内だと
FileReader
かな。