_Timer

计时器类。 全部展开

构造方法展开

  • + function _Timer() : _Timer

公共方法展开

  • + function pause( name : string )

    暂停计时器。

    • 参数
    • name:暂停的计时器的逻辑名称。
    • 示例

       t = _Timer.new()
      function cfun()
      print('hello')
      t:pause('timer')
      end
      t:start('timer', 1000, cfun)
  • + function reset( name : string )

    重置计时器。

    • 参数
    • name:重置的计时器的逻辑名称。
    • 示例

       t = _Timer.new()
      function cfun()
      print('hello')
      end
      t:start('timer', 1000, cfun)
      t:reset('timer')
  • + function resume( name : string )

    唤醒计时器。

    • 参数
    • name:唤醒的计时器的逻辑名称。
    • 示例

       t = _Timer.new()
      function cfun()
      print('hello')
      t:pause('timer')
      end
      t:start('timer', 1000, cfun)
      t:resume('timer')
  • + function start(name : string, duration : uint, callback : function)

    计时器开始计时。

    • 参数
    • name:计时器的逻辑名称。
    • duration:计时时长。
    • callback:回调函数。
    • 示例

       t = _Timer.new()
      function cfun()
      print('hello')
      end
      t:start('timer', 1000, cfun)
  • + function stop(name : string)

    停止计时器。

    • 参数
    • name:停止的计时器的逻辑名称。
    • 示例

       t = _Timer.new()
      function cfun()
      print('hello')
      t:stop('timer')
      end
      t:start('timer', 1000, cfun)
问题反馈(登录才可以发表哦!)