javascript – Implementing mutex mechanism in JS properly

I need some inputon this. Searched for more libraries but no one seems to perform fully asynchronously. The closest is async-mutex but it’s written in TypeScript not compatible with ES6.

My framework draft is this

class Mutex {
    constructor() {
        this.promise = Promise.resolve();
    }

    runExclusive(callback, ...args) {
        return (this.promise = this.promise.then(() => callback(...args)));
    }
}

let mutex = new Mutex();

console.log('Thread A before mutex...');
mutex.runExclusive(function() {
    console.log('Thread A acquired lock...');
    for (let i = 0; i < 10**10; ++i) { }
    console.log('Thread A releasing lock...');
}).then(function() {
    console.log('Thread A after mutex...');
    for (let i = 0; i < 10**9; ++i) { }
    console.log('Thread A after mutex...');
});

console.log('Thread B before mutex...')
mutex.runExclusive(function() {
    console.log('Thread B acquired lock...');
    for (let i = 0; i < 10**8; ++i) { }
    console.log('Thread B releasing lock...');
}).then(function() {
    console.log('Thread B after mutex...');
    for (let i = 0; i < 10**9; ++i) { }
    console.log('Thread B after mutex...');
});

The problem is all critical section runners are chained into one, unlocked simultaneously when all finish, waiting for the last runner. Thanks for ideas.