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