@dereekb/rxjs 12.6.21 → 12.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/rxjs",
3
- "version": "12.6.21",
3
+ "version": "12.7.0",
4
4
  "exports": {
5
5
  ".": {
6
6
  "types": "./src/index.d.ts",
package/src/lib/lock.d.ts CHANGED
@@ -1,26 +1,27 @@
1
1
  import { type ObservableOrValue } from './rxjs/getter';
2
- import { type Observable, type Subscription } from 'rxjs';
2
+ import { type Subscription, type Observable } from 'rxjs';
3
3
  import { type Destroyable, type Maybe } from '@dereekb/util';
4
4
  export type LockKey = string;
5
5
  export type OnLockSetUnlockedFunction = (unlocked: boolean) => void;
6
6
  export type RemoveLockFunction = () => void;
7
7
  export interface OnLockSetUnlockedConfig {
8
- lockSet: LockSet;
9
- fn: OnLockSetUnlockedFunction;
10
- timeout?: Maybe<number>;
11
- delayTime?: Maybe<number>;
8
+ readonly lockSet: LockSet;
9
+ readonly fn?: Maybe<OnLockSetUnlockedFunction>;
10
+ readonly timeout?: Maybe<number>;
11
+ readonly delayTime?: Maybe<number>;
12
12
  }
13
+ export type DestroyOnNextUnlockConfig = Omit<OnLockSetUnlockedConfig, 'lockSet'>;
13
14
  export interface SetLockedConfig {
14
15
  /**
15
16
  * Whether or not to lock the config.
16
17
  */
17
- locked?: boolean;
18
+ readonly locked?: boolean;
18
19
  /**
19
20
  * Optional duration to set the locked state.
20
21
  *
21
22
  * Only relevant for locking.
22
23
  */
23
- duration?: number;
24
+ readonly duration?: number;
24
25
  }
25
26
  export declare const DEFAULT_LOCK_SET_TIME_LOCK_KEY = "timelock";
26
27
  /**
@@ -34,14 +35,16 @@ export declare function onLockSetNextUnlock({ lockSet, fn, timeout: inputTimeout
34
35
  */
35
36
  export declare class LockSet implements Destroyable {
36
37
  private static LOCK_SET_CHILD_INDEX_STEPPER;
37
- private _locks;
38
- private _parentSub;
38
+ private readonly _onDestroy;
39
+ private readonly _locks;
40
+ private readonly _parentSub;
39
41
  readonly locks$: Observable<Map<string, Observable<boolean>>>;
40
42
  /**
41
43
  * isLocked$ is true if any observable is emitting true.
42
44
  */
43
45
  readonly isLocked$: Observable<boolean>;
44
46
  readonly isUnlocked$: Observable<boolean>;
47
+ readonly onDestroy$: Observable<void>;
45
48
  private get locks();
46
49
  setLocked(key: LockKey, config: SetLockedConfig): void;
47
50
  setLocked(key: LockKey, config: boolean, duration?: number): void;
@@ -56,6 +59,6 @@ export declare class LockSet implements Destroyable {
56
59
  * Convenience function for watching a child lockset's locked state and propogating it upward.
57
60
  */
58
61
  addChildLockSet(lockSet: LockSet, key?: LockKey): RemoveLockFunction;
59
- destroyOnNextUnlock(config?: OnLockSetUnlockedFunction | Omit<OnLockSetUnlockedConfig, 'lockSet'>, delayTime?: number): void;
62
+ destroyOnNextUnlock(config?: Maybe<DestroyOnNextUnlockConfig['fn'] | DestroyOnNextUnlockConfig>, delayTime?: number): void;
60
63
  destroy(): void;
61
64
  }