export default function getMessageService()

in src/figma/services/message_service.ts [9:34]


export default function getMessageService(): MessageService {
  function updateSelection(): void {
    const selection = getCurrentSelection();

    figma.ui.postMessage({
      type: FIGMA_MESSAGE_TYPES.UPDATE_SELECTION,
      data: {
        selection: {
          frames: selection.frames,
          components: selection.components,
        },
      },
    });
  }

  async function updateUserConfig(): Promise<void> {
    const userConfig = await getUserConfig();

    figma.ui.postMessage({
      type: FIGMA_MESSAGE_TYPES.SET_USER_CONFIG,
      data: userConfig,
    });
  }

  return { updateSelection, updateUserConfig };
}