ZiuChen.github.io/assets/demos_promiseify-post-message_index.md.D5dAeSHG.js

2 lines
1.5 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{g as m}from"./chunks/theme.Cpi_z6lf.js";import{d as p,h as l,l as f,o as r,c as i,m as o,q as _,s as u,_ as g,J as h,a as y}from"./chunks/framework.BFSS5Pox.js";function b(e){window.addEventListener("message",async s=>{const a=s.data,t=a.namespace,c=a.action,n=m(v,[t,c]);if(n){const d=await n(a.payload);e.postMessage({params:a,result:d},"*")}})}const v={user:{getUserToken:({userId:e})=>"token:"+e}},x=e=>(_("data-v-6e7a6b64"),e=e(),u(),e),P={class:"home"},k=x(()=>o("h2",null,"Home",-1)),M=p({__name:"Index",setup(e){const s=l(null);return f(()=>{s.value&&s.value.contentWindow&&b(s.value.contentWindow)}),(a,t)=>(r(),i("div",P,[k,o("iframe",{ref_key:"iframeRef",ref:s,src:"/demos/promiseify-post-message/inner",frameborder:"0"},null,512)]))}}),w=g(M,[["__scopeId","data-v-6e7a6b64"]]),I=o("h1",{id:"promiseify-postmessage",tabindex:"-1"},[y("Promiseify PostMessage "),o("a",{class:"header-anchor",href:"#promiseify-postmessage","aria-label":'Permalink to "Promiseify PostMessage"'},"")],-1),B=o("p",null,"将 postMessage 消息通信 Promise 化",-1),$=JSON.parse('{"title":"Promiseify PostMessage","description":"","frontmatter":{"layout":"page","navbar":false,"sidebar":false,"aside":false,"footer":false},"headers":[],"relativePath":"demos/promiseify-post-message/index.md","filePath":"demos/promiseify-post-message/index.md","lastUpdated":1712031455000}'),N={name:"demos/promiseify-post-message/index.md"},C=Object.assign(N,{setup(e){return(s,a)=>(r(),i("div",null,[I,B,h(w)]))}});export{$ as __pageData,C as default};