javascript 灰烬样品计数器

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了javascript 灰烬样品计数器相关的知识,希望对你有一定的参考价值。

{{counter-component}}
{{outlet}}
{{count}}

<button {{action "stopCounter"}}>Stop</button>
<button {{action "startCounter"}}>Start</button>
import Component from '@ember/component';
import { later } from '@ember/runloop';

export default Component.extend({
  count: 0,
  timerStatus: 1,

  init() {
    this._super(...arguments);
    this.updateCounter();
  },

  updateCounter() {
    if (this.timerStatus) {
      this.incrementProperty('count');
      later(this, this.updateCounter, 1000);
    }
  },

  actions: {
    startCounter() {
      this.set('timerStatus', 1);
      this.updateCounter();
    },

    stopCounter() {
      this.set('timerStatus', 0);
    }
  }
});

以上是关于javascript 灰烬样品计数器的主要内容,如果未能解决你的问题,请参考以下文章

为什么线程在《奇点灰烬》* 中至关重要

s-s-rS 条件表达式有助于按组区分计数

游戏开发实战教你在Unity中实现模型消融化为灰烬飘散的效果(ShaderGraph | 消融 | 粒子系统 | 特效)

游戏开发实战教你在Unity中实现模型消融化为灰烬飘散的效果(ShaderGraph | 消融 | 粒子系统 | 特效)

游戏开发实战教你在Unity中实现模型消融化为灰烬飘散的效果(ShaderGraph | 消融 | 粒子系统 | 特效)

游戏开发实战教你在Unity中实现模型消融化为灰烬飘散的效果(ShaderGraph | 消融 | 粒子系统 | 特效)