idGenerator.js 595 B

1234567891011121314
  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. export class IdGenerator {
  6. constructor(prefix) {
  7. this._prefix = prefix;
  8. this._lastId = 0;
  9. }
  10. nextId() {
  11. return this._prefix + (++this._lastId);
  12. }
  13. }
  14. export const defaultGenerator = new IdGenerator('id#');