Sha256: 5a5356ed16901d4a3e93e70efda22e399d3ccb92e88974b3d8c6f648df03fcc0

Contents?: true

Size: 693 Bytes

Versions: 21

Compression:

Stored size: 693 Bytes

Contents

service("timer") do
  on_init %{
    //Entries in the timer event table are stored as an array of arrays, each array
    //contains [N, bp, event_name]

    var timer_evt = [];
    //Call an event N times per second
    function reg_timer_ev(n, bp, ename) {
      timer_evt.push([n, bp, ename]);
    }

    //Timer position
    var ttick = 0;
    function int_timer() {
      ttick += 1;

      for (var i = 0; i < timer_evt.length; ++i) {
        if (ttick % timer_evt[i][0] == 0) {
          var bp = timer_evt[i][1];
          var ename = timer_evt[i][2];
          int_event(bp, ename, {});
        }
      }
    }
  }

  on_request %{
    timer_evt.push([info.ticks, ep, ename]);
  }
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
flok-0.0.36 app/kern/services/timer.rb
flok-0.0.35 app/kern/services/timer.rb
flok-0.0.34 app/kern/services/timer.rb
flok-0.0.33 app/kern/services/timer.rb
flok-0.0.32 app/kern/services/timer.rb
flok-0.0.31 app/kern/services/timer.rb
flok-0.0.30 app/kern/services/timer.rb
flok-0.0.29 app/kern/services/timer.rb
flok-0.0.28 app/kern/services/timer.rb
flok-0.0.27 app/kern/services/timer.rb
flok-0.0.26 app/kern/services/timer.rb
flok-0.0.25 app/kern/services/timer.rb
flok-0.0.24 app/kern/services/timer.rb
flok-0.0.23 app/kern/services/timer.rb
flok-0.0.21 app/kern/services/timer.rb
flok-0.0.20 app/kern/services/timer.rb
flok-0.0.19 app/kern/services/timer.rb
flok-0.0.18 app/kern/services/timer.rb
flok-0.0.17 app/kern/services/timer.rb
flok-0.0.16 app/kern/services/timer.rb