mirror of
https://github.com/ZiuChen/ZiuChen.github.io.git
synced 2025-09-11 13:13:42 +08:00
2 lines
1.5 KiB
JavaScript
2 lines
1.5 KiB
JavaScript
import{d as f,h as l,l as _,o as c,c as d,m as o,q as u,s as h,_ as g,J as y,a as v}from"./chunks/framework.BFSS5Pox.js";function x(e){window.addEventListener("message",async s=>{var i;const a=s.data,n=a.namespace,m=a.action,r=(i=t==null?void 0:t[n])==null?void 0:i[m];if(r){const p=await r(a.payload);e.postMessage({params:a,result:p},"*")}})}const t={user:{getUserToken:({userId:e})=>"token:"+e}},P=e=>(u("data-v-6e7a6b64"),e=e(),h(),e),b={class:"home"},k=P(()=>o("h2",null,"Home",-1)),w=f({__name:"Index",setup(e){const s=l(null);return _(()=>{s.value&&s.value.contentWindow&&x(s.value.contentWindow)}),(a,n)=>(c(),d("div",b,[k,o("iframe",{ref_key:"iframeRef",ref:s,src:"/demos/promiseify-post-message/inner",frameborder:"0"},null,512)]))}}),I=g(w,[["__scopeId","data-v-6e7a6b64"]]),M=o("h1",{id:"promiseify-postmessage",tabindex:"-1"},[v("Promiseify PostMessage "),o("a",{class:"header-anchor",href:"#promiseify-postmessage","aria-label":'Permalink to "Promiseify PostMessage"'},"")],-1),B=o("p",null,"将 postMessage 消息通信 Promise 化",-1),V=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":1712924096000}'),N={name:"demos/promiseify-post-message/index.md"},$=Object.assign(N,{setup(e){return(s,a)=>(c(),d("div",null,[M,B,y(I)]))}});export{V as __pageData,$ as default};
|