5,321
edits
(→Usage) |
No edit summary |
||
(2 intermediate revisions by the same user not shown) | |||
Line 28: | Line 28: | ||
console.log(match[1], match[2]); | console.log(match[1], match[2]); | ||
console.table(match); | console.table(match); | ||
</syntaxhighlight> | |||
Line 64: | Line 65: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==Compilation== | |||
===Webpack=== | |||
===Babel=== | |||
==Websockets== | |||
How to use Websockets | |||
===Getting Started=== | |||
<syntaxhighlight lang="javascript"> | |||
let ws = new WebSocket(this.SERVER_URL); | |||
ws.onopen = function(event) { | |||
console.log("Websocket opened"); | |||
ws.send("Hi"); | |||
}; | |||
ws.onmessage = function(event) { | |||
console.log("message received"); | |||
console.log(event.data); | |||
}; | |||
ws.onclose = function() { | |||
console.log("WS Closed"); | |||
}; | |||
</syntaxhighlight> | </syntaxhighlight> | ||
==Modules== | ==Modules== | ||
===Getting Started=== | |||
[https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules MDN Guide to Modules]<br> | |||
<syntaxhighlight lang="javascript"> | |||
</syntaxhighlight> |