【文件属性】:
文件名称:async-deno:异步原始模块从Python的Deno的asyncio松散移植
文件大小:16KB
文件格式:ZIP
更新时间:2021-04-12 22:49:38
async deno TypeScript
异步术语
异步原始模块从松散端口为。
用法
锁
锁可用于保证对共享资源的独占访问。
import { Lock } from "https://deno.land/x/async/mod.ts" ;
import { delay } from "https://deno.land/std@0.86.0/async/mod.ts" ;
const lock = new Lock ( ) ;
const task1 = async ( ) => {
await lock . with ( async ( ) => {
await delay ( 50 ) ;
console . log ( "Task1 start" ) ;
await delay ( 100 ) ;
console . log ( "Task1 end" ) ;
} ) ;
} ;
【文件预览】:
async-deno-main
----mod.ts(175B)
----deps_test.ts(167B)
----condition_test.ts(4KB)
----condition.ts(3KB)
----event_test.ts(2KB)
----.github()
--------workflows()
----deps.ts(156B)
----semaphore_test.ts(4KB)
----LICENSE(1KB)
----event.ts(1KB)
----queue.ts(3KB)
----examples()
--------condition.ts(983B)
--------event.ts(542B)
--------queue.ts(606B)
--------semaphore.ts(939B)
--------lock.ts(762B)
----state_test.ts(1KB)
----lock_test.ts(2KB)
----semaphore.ts(3KB)
----README.md(6KB)
----lock.ts(2KB)
----queue_test.ts(3KB)
----state.ts(538B)