All files / src allow-communication-to-iframe.injectable.ts

100% Statements 25/25
100% Branches 2/2
100% Functions 2/2
100% Lines 25/25

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 261x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x  
import { getInjectable } from "@ogre-tools/injectable";
import { onLoadOfApplicationInjectionToken } from "@k8slens/application";
import { getMessageChannel, sendMessageToChannelInjectionToken } from "@k8slens/messaging";
 
export const frameCommunicationAdminChannel = getMessageChannel<undefined>(
  "frame-communication-admin-channel",
);
 
const allowCommunicationToIframeInjectable = getInjectable({
  id: "allow-communication-to-iframe-injectable",
 
  instantiate: (di) => {
    const sendMessageToChannel = di.inject(sendMessageToChannelInjectionToken);
 
    return {
      run: () => {
        sendMessageToChannel(frameCommunicationAdminChannel);
      },
    };
  },
 
  injectionToken: onLoadOfApplicationInjectionToken,
});
 
export default allowCommunicationToIframeInjectable;