diff --git a/media/annotationPanel/index.html b/media/annotationPanel/index.html
index d568420..6a04c72 100644
--- a/media/annotationPanel/index.html
+++ b/media/annotationPanel/index.html
@@ -82,7 +82,17 @@
Bounding Box
(() => {
const nativeAcquire = window.acquireVsCodeApi;
let sharedApi;
- window.acquireVsCodeApi = () => sharedApi || (sharedApi = nativeAcquire());
+ window.acquireVsCodeApi = () => {
+ if (!sharedApi) {
+ const nativeApi = nativeAcquire();
+ sharedApi = {
+ postMessage: (...args) => nativeApi.postMessage(...args),
+ getState: (...args) => nativeApi.getState(...args),
+ setState: (...args) => nativeApi.setState(...args),
+ };
+ }
+ return sharedApi;
+ };
})();