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