Skip to content

Commit

Permalink
fix memoize warning
Browse files Browse the repository at this point in the history
fixes #46643
  • Loading branch information
isidorn committed Mar 27, 2018
1 parent 062f3f7 commit d22af8f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/vs/platform/actions/browser/menuItemActionItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { ActionItem, Separator } from 'vs/base/browser/ui/actionbar/actionbar';
import { domEvent } from 'vs/base/browser/event';
import { Emitter } from 'vs/base/common/event';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { memoize } from 'vs/base/common/decorators';
import { IdGenerator } from 'vs/base/common/idGenerator';
import { createCSSRule } from 'vs/base/browser/dom';
import URI from 'vs/base/common/uri';
Expand All @@ -26,6 +25,7 @@ class AlternativeKeyEmitter extends Emitter<boolean> {

private _subscriptions: IDisposable[] = [];
private _isPressed: boolean;
private static instance: AlternativeKeyEmitter;

private constructor(contextMenuService: IContextMenuService) {
super();
Expand All @@ -49,9 +49,12 @@ class AlternativeKeyEmitter extends Emitter<boolean> {
this.fire(this._isPressed);
}

@memoize
static getInstance(contextMenuService: IContextMenuService) {
return new AlternativeKeyEmitter(contextMenuService);
if (!AlternativeKeyEmitter.instance) {
AlternativeKeyEmitter.instance = new AlternativeKeyEmitter(contextMenuService);
}

return AlternativeKeyEmitter.instance;
}

dispose() {
Expand Down

0 comments on commit d22af8f

Please sign in to comment.