How to use the post-robot.send function in post-robot

To help you get started, we’ve selected a few post-robot examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github EdgeApp / edge-login-ui / packages / edge-login-ui-web / src / client / client-state.js View on Github external
} = opts
  const { onError = onErrorNop } = callbacks

  let state: ClientState
  const message: ConnectionMessage = {
    apiKey,
    appId,
    hideKeys,
    vendorName,
    vendorImageUrl,
    clientDispatch: message => clientDispatch(state, message)
  }

  // Set up the frame:
  const frame = makeFrame(assetsPath)
  return postRobot
    .send(frame, 'connect', message, { timeout: frameTimeout })
    .then((reply: PostRobotEvent) => {
      const frameDispatch: any = reply.data.frameDispatch
      state = {
        accounts: {},
        appId,
        createCurrencyWallet: reply.data.createCurrencyWallet,
        createWallet: reply.data.createWallet,
        signEthereumTransaction: reply.data.signEthereumTransaction,
        frame,
        frameDispatch,
        localUsers: reply.data.localUsers,
        onClose: void 0,
        onError,
        onLogin: void 0
      }
github buttercup / buttercup-browser-extension / source / dialog / library / context.js View on Github external
export function openURL(url) {
    return postRobot.send(window.top, "bcup-open-url", { url });
}
github Bearer / bearer-js / packages / core / src / bearer.ts View on Github external
new Promise((resolve, reject) => {
      postRobot
        .send(this.iframe, Events.HAS_AUTHORIZED, {
          integrationId,
          clientId: Bearer.config.clientId
        })
        .then(({ data, data: { authorized } }: { data: { authorized: boolean } }) => {
          logger('HAS_AUTHORIZED response %j', data)
          authorized ? resolve(true) : reject(false)
        })
        .catch(iframeError)
    })
github buttercup / buttercup-browser-extension / source / dialog / library / context.js View on Github external
export function getTopURL() {
    return postRobot.send(window.top, "bcup-get-url").then(response => {
        return response.data;
    });
}
github buttercup / buttercup-browser-extension / source / dialog / library / context.js View on Github external
export function closeDialog() {
    return postRobot.send(window.top, "bcup-close-dialog");
}
github Bearer / bearer-js / packages / core / src / bearer.ts View on Github external
revokeAuthorization = (integrationId: string, authId: string): void => {
    postRobot
      .send(this.iframe, Events.REVOKE, {
        authId,
        integrationId,
        clientId: Bearer.config.clientId
      })
      .then(() => {
        logger('Signing out')
      })
      .catch(iframeError)
  }