703612796298cd4858cf8bdf3ddeb1e9a9b1ca696ca87235abb6cf11b185a6e13c288e29e103fa22c8413c6a3de5a12963030b9ccec28d70503d84e61b3e59 875 B

123456789101112131415161718192021
  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. import * as Assert from '../../../base/common/assert.js';
  6. import * as Types from '../../../base/common/types.js';
  7. class RegistryImpl {
  8. constructor() {
  9. this.data = new Map();
  10. }
  11. add(id, data) {
  12. Assert.ok(Types.isString(id));
  13. Assert.ok(Types.isObject(data));
  14. Assert.ok(!this.data.has(id), 'There is already an extension with this id');
  15. this.data.set(id, data);
  16. }
  17. as(id) {
  18. return this.data.get(id) || null;
  19. }
  20. }
  21. export const Registry = new RegistryImpl();