当前位置: 首页 > news >正文

吉林省建设部网站wordpress主题 大前端 阿里百秀 xiu

吉林省建设部网站,wordpress主题 大前端 阿里百秀 xiu,哈尔滨论坛建站模板,移动 网站模板BroadcastChannel与MessageChannel BroadcastChannel BroadcastChannel以广播的形式进行通信 BroadcastChannel用于创建浏览器标签页之间的通信 使用BroadcastChannel的浏览器标签页面必须要遵循同源策略 页面1使用BroadcastChannel创建一个频道#xff0c;页面2使用Broadc…BroadcastChannel与MessageChannel BroadcastChannel BroadcastChannel以广播的形式进行通信 BroadcastChannel用于创建浏览器标签页之间的通信 使用BroadcastChannel的浏览器标签页面必须要遵循同源策略 页面1使用BroadcastChannel创建一个频道页面2使用BroadcastChannel链接频道页面1与页面2即可通信。 let m1new BroadcastChannel(channel);//入参是创建或链接的频道名没有频道则创建通信频道有频道则进入频道 m1.postMessage(data数据);//以广播的形式向其他链接频道的标签发送消息 m1.onmessage(e){console.log(e);//接收频道发送过来的消息 }实例 //BroadcastChannel1.html !DOCTYPE html html langen headmeta charsetUTF-8meta http-equivX-UA-Compatible contentIEedgemeta nameviewport contentwidthdevice-width, initial-scale1.0titleDocument/title /head bodya hrefhttp://127.0.0.1:8080/BroadcastChannel2.html target_blank打开新的标签页/abutton onclicksend()点击/buttonscriptconst m1new BroadcastChannel(one);function send(){m1.postMessage({data:123123})}m1.onmessage(e){console.log(e,e);}/script /body /html//BroadcastChannel2.html !DOCTYPE html html langen headmeta charsetUTF-8meta http-equivX-UA-Compatible contentIEedgemeta nameviewport contentwidthdevice-width, initial-scale1.0titleDocument/title /head bodyscriptconst m1new BroadcastChannel(one);m1.onmessage(e){console.log(e,e)}m1.postMessage(adad)/script /body /htmlMessageChannel MessageChannel以通道的形式进行传值 MessageChannel无法跨越浏览器标签页通信只能在当前标签页进行通信 MessageChannel的对象只有两个端口prot1、port2 let mnew MessageChannel();//创建消息通道 //m有两个端口prot1、prot2 m.port1.postMessage(data数据);//prot1数据肯定是向prot2发送同理prot2也只能向prot1发送数据 m.prot2.onmessage(e){console.log(e);//prot2接收prot1发送的数据 }实例 !DOCTYPE html html langen headmeta charsetUTF-8meta http-equivX-UA-Compatible contentIEedgemeta nameviewport contentwidthdevice-width, initial-scale1.0titleDocument/title /head bodyscriptlet mnew MessageChannel();m.port1.postMessage(data);m.port2.onmessage(e){console.log(e);}/script /body /htmlTips使用MessageChannel传递的引用数据类型是深拷贝。也就是改变端口数据的值发送端的数据不会改变。
http://www.hkea.cn/news/14315226/

相关文章:

  • 免费制作网站app有中文网站 怎么做英文网站
  • 微信公众号小说代理和网站结合怎么做网站做优化公司
  • 自己做网站平台吕梁网站制作吕梁安全
  • 网站设计展示Wordpress不能修改导航名称
  • 化妆品网站建设的维护兰州市新闻头条
  • 企业建站找哪家小程序开发公司网站源码下载
  • 8211 wordpress网站框架优化
  • 凡科网做网站如何推广如何规避电子政务门户网站建设教训
  • 做动图素材网站优化大师网页版
  • 有域名和主机怎么做网站收费的网站如何免费
  • 传媒公司网站建设思路seo职位
  • 个人网站开发的感想石家庄网页定制开发
  • 交通局网站模板做单页网站
  • 个人博客模板网站网页设计师培训哪个好
  • 做不了大流量网站南宁隆安网站建设
  • html5网站开发书籍哪个网站可以免费下载电视剧看
  • 15年做哪些网站致富淘宝网页打不开是什么原因
  • 网站建设登录结构图西安房产信息网官网
  • 苏州企业网站建站系统安徽制作网站专业公司
  • 湖南网红网站建设有限公司oppo软件商店官方网页
  • 中文单页面网站模板seo和网站建设那个先学
  • 兖州建设局网站微信头像做国旗网站
  • 成都高新区建设厅网站描述网站开发的广告词
  • php网站模板怎么用商城源码免费
  • 网站开发好什么进行界面的优化wordpress微信公众号企业版
  • 多个wordpress站点同步上海58同城招聘网最新招聘
  • 东莞企业网站模板建站做电影分享网站违法吗
  • 精品网站建设平台怎样做直播网站app
  • wordpress站点如何添加百度分享代码dede做视频网站
  • 网站建设文化服务郑州搭建网站公司