Created
October 3, 2019 12:03
-
-
Save Jxck/010463ac9e326badda883a1f2571c795 to your computer and use it in GitHub Desktop.
This file contains 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
declare global { | |
// EventTarget に on を生やすと addEventListener を on と書ける | |
// e.g. ws.on('message', ()=>{}) | |
interface EventTarget { | |
on: typeof EventTarget.prototype.addEventListener; | |
} | |
} | |
WebSocket.prototype.on = WebSocket.prototype.addEventListener |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment