+
Skip to content

hviana/ts_mutex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ts_mutex

Simple TypeScript Mutex Implementation

Example Usage

const shoppingCartMutex = new Mutex();

shoppingCartMutex.runExclusive(async () => {
  cart.add(items);
  total = await cart.calculateTotal();
});

shoppingCartMutex.runExclusive(async () => {
  await cart.applyCoupons();
  total = await cart.calculateTotal();
});

All imports

import { Mutex, ReleaseFunction } from "jsr:@hviana/ts-mutex";

About

Based on (https://dev.to/0916dhkim/simple-typescript-mutex-implementation-5544)

Author: Henrique Emanoel Viana, a Brazilian computer scientist, enthusiast of web technologies, cel: +55 (41) 99999-4664. URL: https://sites.google.com/view/henriqueviana

Improvements and suggestions are welcome!

About

Simple TypeScript Mutex Implementation

Resources

License

Stars

Watchers

Forks

Packages

No packages published
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载