1
>
/*---------------------------------------------------------------------------------------------
idGenerator.ts
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
}
20
>
21
>
export const defaultGenerator = new IdGenerator('id#');