Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/editor/browser/controller/editContext/native/nativeEditContextRegistry.ts
3296 views
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
6
import { IDisposable } from '../../../../../base/common/lifecycle.js';
7
import { NativeEditContext } from './nativeEditContext.js';
8
9
class NativeEditContextRegistryImpl {
10
11
private _nativeEditContextMapping: Map<string, NativeEditContext> = new Map();
12
13
register(ownerID: string, nativeEditContext: NativeEditContext): IDisposable {
14
this._nativeEditContextMapping.set(ownerID, nativeEditContext);
15
return {
16
dispose: () => {
17
this._nativeEditContextMapping.delete(ownerID);
18
}
19
};
20
}
21
22
get(ownerID: string): NativeEditContext | undefined {
23
return this._nativeEditContextMapping.get(ownerID);
24
}
25
}
26
27
export const NativeEditContextRegistry = new NativeEditContextRegistryImpl();
28
29