๐Ÿ“ฆ retyui / react-native-stylex

๐Ÿ“„ dependencyUsage.ts ยท 22 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22interface UsingSpec {
  [dependencyName: string]: boolean;
}

interface Ref {
  current: UsingSpec;
}

const ref: Ref = { current: {} };

export function resetUsing(): void {
  ref.current = {};
}

export function getUsing(): UsingSpec {
  return { ...ref.current };
}

export function onUse(name: string): void {
  ref.current[name] = true;
}