Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

@joinposter/manage-platform

Client library for apps embedded by Poster manage platform in an iframe. Provides a small, framework-agnostic surface for talking to the host page.

Install

yarn add @joinposter/manage-platform
# or
npm install @joinposter/manage-platform

Usage

import { hideSpinner } from "@joinposter/manage-platform";

hideSpinner();

Available actions

Action Purpose
hideSpinner() Tell the host page to hide its loading spinner over the iframe

More actions (openUrl, setTitle, setUrl) will be added as we migrate callers.

Local development

The library is built with Vite library mode. Run a watch build, then link it into a consumer app:

cd poster-manage-platform
yarn install
yarn dev            # rebuilds dist/ on every change
yarn link

cd ../<consumer-app>
yarn link @joinposter/manage-platform
yarn dev

When you're done:

cd <consumer-app>
yarn unlink @joinposter/manage-platform
yarn install --force

cd ../poster-manage-platform
yarn unlink

Publishing

# bump version in package.json
yarn build         # also runs automatically via `prepublishOnly`
npm publish

The package is scoped under @joinposter; publishConfig.access = "public" keeps it publicly installable.

Architecture

src/
  index.js                         # public entry, named exports per action
  host/
    postToHost.js                  # single chokepoint over window.top.postMessage
    actions/
      hideSpinner.js               # builds the { hideSpinner: true } payload

Every public action is a stateless postMessage to window.top. host/postToHost.js is the only place that touches the browser API, which keeps target-origin policy, sender identity, and any future handshake in one spot.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages