2023-02-26 01:30
This commit is contained in:
23
hello-js/index.html
Normal file
23
hello-js/index.html
Normal file
@@ -0,0 +1,23 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>Test</title>
|
||||
<style>
|
||||
.test {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.test p {
|
||||
background-color: aqua;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body style="background-color: white;margin:0; overflow: hidden;">
|
||||
<div class="test">
|
||||
<p>Hello</p>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
13
hello-js/package.json
Normal file
13
hello-js/package.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "hello-js",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"run01": "node test01.js",
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC"
|
||||
}
|
||||
17
hello-js/test01.js
Normal file
17
hello-js/test01.js
Normal file
@@ -0,0 +1,17 @@
|
||||
let websocket = new WebSocket("wss://echo.websocket.org/");
|
||||
|
||||
websocket.onopen((event) => {
|
||||
websocket.send("Hello");
|
||||
});
|
||||
|
||||
websocket.onclose(() => {
|
||||
|
||||
});
|
||||
|
||||
websocket.onmessage((event) => {
|
||||
console.log(event.data);
|
||||
});
|
||||
|
||||
websocket.onerror(() => {
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user