Async Programming All in One
Async Programming All in One
Async & Await
Frontend
(async () => {
const url = "https://cdn.xgqfrms.xyz/json/awesome-developer.json"
const result = await fetch(url).json()
if(result.name == `xgqfrms`) {
alert('You are awesome!')
} else {
alert('You are awesome too!')
}
})();
Backend
#!/usr/bin/env python
import asyncio as io
import websockets as ws
async def hello(websocket, path):
name = await websocket.recv()
greeting = f"Hello {name}!"
await websocket.send(greeting)
server = ws.serve(hello, 'localhost', 1337)
io.get_event_loop().run_until_complete(server)
io.get_event_loop().run_forever()
Mobile APP
import 'package:flutter/widgets.dart';
void main() {
runApp(
const Center(
child: Text(
'Hello, world!',
textDirection: TextDirection.ltr
)
)
);
}
DevOps
version: 2
jobs:
build:
docker:
- image: circleci/node:8.11.2
working_directory: ~/codedamn
steps:
- checkout
- run:
name: Install Dependencies
command: npm install
- run: npm run test
refs
vim
©xgqfrms 2012-2020
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/13344603.html
未经授权禁止转载,违者必究!