ime.js 897 B

123456789101112131415161718192021222324252627282930
  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 { Emitter } from './event.js';
  6. export class IMEImpl {
  7. constructor() {
  8. this._onDidChange = new Emitter();
  9. this.onDidChange = this._onDidChange.event;
  10. this._enabled = true;
  11. }
  12. get enabled() {
  13. return this._enabled;
  14. }
  15. /**
  16. * Enable IME
  17. */
  18. enable() {
  19. this._enabled = true;
  20. this._onDidChange.fire();
  21. }
  22. /**
  23. * Disable IME
  24. */
  25. disable() {
  26. this._enabled = false;
  27. this._onDidChange.fire();
  28. }
  29. }
  30. export const IME = new IMEImpl();