支持 js websocket
This commit is contained in:
5
examples/js_event/.pages.yaml
Normal file
5
examples/js_event/.pages.yaml
Normal file
@@ -0,0 +1,5 @@
|
||||
routes:
|
||||
- path: "**"
|
||||
js:
|
||||
exec: "index.js"
|
||||
debug: true
|
||||
12
examples/js_event/index.html
Normal file
12
examples/js_event/index.html
Normal file
@@ -0,0 +1,12 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport"
|
||||
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title>JS 概念验证</title>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
18
examples/js_event/index.js
Normal file
18
examples/js_event/index.js
Normal file
@@ -0,0 +1,18 @@
|
||||
function sleep(ms) {
|
||||
return new Promise(resolve => setTimeout(resolve, ms));
|
||||
}
|
||||
console.log('boot');
|
||||
(async () => {
|
||||
console.log(0);
|
||||
await sleep(1000);
|
||||
console.log(1000);
|
||||
await sleep(1000);
|
||||
console.log(2000);
|
||||
await sleep(1000);
|
||||
console.log(3000);
|
||||
await sleep(1000);
|
||||
console.log(4000);
|
||||
await sleep(1000);
|
||||
console.log(5000);
|
||||
})();
|
||||
console.log('boot end');
|
||||
Reference in New Issue
Block a user