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

扬州做网站的网络公司免费自助建站哪个平台好

扬州做网站的网络公司,免费自助建站哪个平台好,wordpress图片预加载,专门做金融培训的网站有哪些vue2中使用web worker启动定时器#xff0c;避免浏览器最小化或切换标签页时定时器不能按设定周期执行【一般是周期小于60s时#xff0c;大于60s一般可正常执行】 1、添加worker-loader2、修改vue.config.js3、创建timer.worker.js4、创建TimerWorker.js5、使用TimerWorker启… vue2中使用web worker启动定时器避免浏览器最小化或切换标签页时定时器不能按设定周期执行【一般是周期小于60s时大于60s一般可正常执行】 1、添加worker-loader2、修改vue.config.js3、创建timer.worker.js4、创建TimerWorker.js5、使用TimerWorker启动定时任务 1、添加worker-loader npm install worker-loader --save2、修改vue.config.js 新增以下配置 config.module.rule(workers).test(/\.worker\.js$/).use(worker-loader).loader(worker-loader).options({inline: fallback // 尝试内联失败则回退到默认行为})3、创建timer.worker.js self.timers {}self.onmessage function(event) {const { action, id, interval } event.dataswitch (action) {case startTimer:startTimer(id, interval)breakcase stopTimer:stopTimer(id)breakcase stopAllTimers:stopAllTimers()break} }function startTimer(id, interval) {if (!self.timers[id]) {self.timers[id] setInterval(() {self.postMessage({ id })}, interval)} }function stopTimer(id) {if (self.timers[id]) {clearInterval(self.timers[id])delete self.timers[id]} }function stopAllTimers() {Object.keys(self.timers).forEach(id {clearInterval(self.timers[id])})self.timers {} } 4、创建TimerWorker.js import Worker from ./timer.worker.jsexport default class TimerWorker {worker;timers;constructor() {this.start()}startTimer(id, interval, fun) {if (this.worker !this.timers[id]) {this.timers[id] funthis.worker.postMessage({ action: startTimer, id, interval })}return this}stopTimer(id) {if (this.worker this.timers[id]) {this.worker.postMessage({ action: stopTimer, id })delete this.timers[id]}return this}stopAllTimers() {if (this.worker) {this.worker.postMessage({ action: stopAllTimers })this.timers {}}return this}start() {if (!this.worker) {const worker new Worker()worker.onmessage (event) {this.timers[event.data.id]()}this.worker workerthis.timers {}}return this}terminate() {if (this.worker) {this.stopAllTimers()this.worker.terminate()this.worker undefinedthis.timers undefined}return this} } 5、使用TimerWorker启动定时任务 import TimerWorker from ./TimerWorkerexport default {...created() {this._timerWorker new TimeWorker()this.startTimer()},beforeDestroy() {this._timerWorker.terminate()},methods: {startTimer() {this._timeWorker.startTimer(test, 100, () {console.log(new Date().getTime())})}}... }
http://www.hkea.cn/news/14308759/

相关文章:

  • 资源采集网站如何做注册公司怎么注册啊
  • 有什么做设计接任务的网站网页设计推荐使用路径
  • 安能建设总公司网站打不开游戏网页制作
  • 网站建设的书籍知乎广州知名网站建设后台管理便捷
  • 网站编程设计如何写备注学做网站能找到工作么
  • 永康市建设银行网站查询异地网站建设公司
  • 网站建设微信商城运营手机网站下拉菜单代码
  • 网站建设实训总结范文phpnow 搭建网站
  • 手机网站开发 html5网站备案在线注销
  • 怎么做网站的百度排名wordpress网站打开慢
  • 阿里云网站建设服务费会计科目网站制作案例哪家强
  • 网站模板 哪家好北京网站建设好不好天
  • 做仿牌网站被封临沂市网站建设公司
  • 济南好的网站建设公司排名江苏省建筑培训网
  • 新河镇网站制作电影vip免费网站怎么做的
  • pythom 网站开发规范为离职员工做的网站
  • 网站改名工信部需要怎么做网站金融模版
  • 做购物网站婚庆网站论文
  • 黑网站代码制作百度推广助手app下载
  • 淄博网站制作服务推广网站建设sz886
  • 什么网站专门做境外当地游小广告多的网站
  • dw中旅游网站怎么做wordpress 底部备案号
  • 纯静态网站制作建设银行春招报名网站
  • 能打开所有网站的浏览器wordpress启动命令
  • 教育咨询网站模板公司网站制作多少钱
  • 网站域名续费后SEO查询未更换网站目录做外链
  • 网站如何做数据分析html用什么软件编写
  • 网站建设业务培训泰安做网站的公司
  • Asp做网站前期准备天元建设集团有限公司蒙阴分公司
  • 网站开发的两种模式保定市做网站的电话