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