Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemathinc
GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/frontend/editors/slate/slate-react/utils/key.ts
1698 views
1
/**
2
* An auto-incrementing identifier for keys.
3
*/
4
5
let n = 0;
6
7
/**
8
* A class that keeps track of a key string. We use a full class here because we
9
* want to be able to use them as keys in `WeakMap` objects.
10
*/
11
12
export class Key {
13
id: string;
14
15
constructor() {
16
this.id = `${n++}`;
17
}
18
}
19
20