Guest User

Untitled

a guest
Oct 12th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. /**
  2. * Retrieves non expired locks for this item.
  3. * @returns Enumerable with information about locks.
  4. */
  5. public async getActiveLocks(): Promise<LockInfo[]> {
  6. const locks = await this.getLocks();
  7. if (locks === null) {
  8. return new Array<LockInfo>();
  9. }
  10.  
  11. const lockInfoList = locks.map(l => new LockInfo(
  12. l.level,
  13. l.isDeep,
  14. l.lockToken,
  15. l.expiration === (new Date(8640000000000000).getTime()) ?
  16. (new Date(8640000000000000).getTime()) :
  17. Math.ceil(l.expiration - Date.now()),
  18. l.clientOwner,
  19. l.lockRoot
  20. ));
  21.  
  22. return lockInfoList;
  23. }
Add Comment
Please, Sign In to add comment