Skip to content

Commit

Permalink
Fix locks release method
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominik Piatek authored and dpiatek committed Sep 28, 2023
1 parent 64f6736 commit 5f724b1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion demo/src/utils/locking.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { Space } from '@ably/spaces';

export const releaseMyLocks = async (space: Space) => {
await Promise.all([...space.locks.getSelf().map((lock) => space.locks.release(lock.id))]);
const locks = await space.locks.getSelf();

if (locks.length > 0) {
locks.forEach((lock) => space.locks.release(lock.id));
}
};

export const buildLockId = (slide: string | undefined, element: string | undefined) =>
Expand Down

0 comments on commit 5f724b1

Please sign in to comment.