export function postMessage(method: string, body?: any): Promise<any> {
  return new Promise((resolve, reject) => {
    window.parent.postMessage({
      appId: '3syxin',
      method: method,
      body
    }, '*')
    window.addEventListener('message', handler)
    function handler(e: MessageEvent) {
      const { data } = e
      resolve({
        method,
        data: data.body
      })
      window.removeEventListener('message', handler)
    }
  })
}
