Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/base/common/idGenerator.ts
3291 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
export class IdGenerator {
7
8
private _prefix: string;
9
private _lastId: number;
10
11
constructor(prefix: string) {
12
this._prefix = prefix;
13
this._lastId = 0;
14
}
15
16
public nextId(): string {
17
return this._prefix + (++this._lastId);
18
}
19
}
20
21
export const defaultGenerator = new IdGenerator('id#');
22