Sha256: 7edf8fbcc9f0735e1d9a0fa4a77c04bf81bd540dc932f57e2ad6216eb85d3a6b

Contents?: true

Size: 1.16 KB

Versions: 64

Compression:

Stored size: 1.16 KB

Contents

callout_tick = 0;
callout_queue = {};

function callout_wakeup() {
  callout_tick += 1;

  //Get an array of things that should fire now
  var arr = callout_queue[callout_tick];
  if (arr === undefined) {
    return;
  }
  delete callout_queue[callout_tick];

  for (var i = 0; i < arr.length; ++i) {
    var e = arr[i];

    //Send event
    var ep_ok = int_event(e.ep, e.ename, {});

    //Reschedule interval if the ep still exists
    if (e.interval && ep_ok) {
      reg_interval(e.ep, e.ename, e.ticks);
    }
  }
}

function reg_timeout(ep, ename, ticks) {
  //Create an array if there isn't already one
  if (callout_queue[ticks+callout_tick] === undefined) {
    callout_queue[ticks+callout_tick] = [];
  }

  //Insert an item
  callout_queue[ticks+callout_tick].push({
    ep: ep,
    ename: ename,
    ticks: ticks,
    interval: false
  });
}

function reg_interval(ep, ename, ticks) {
  //Create an array if there isn't already one
  if (callout_queue[ticks+callout_tick] === undefined) {
    callout_queue[ticks+callout_tick] = [];
  }

  //Insert an item
  callout_queue[ticks+callout_tick].push({
    ep: ep,
    ename: ename,
    ticks: ticks,
    interval: true 
  });
}

Version data entries

64 entries across 64 versions & 1 rubygems

Version Path
flok-0.0.64 app/kern/callout.js
flok-0.0.63 app/kern/callout.js
flok-0.0.62 app/kern/callout.js
flok-0.0.61 app/kern/callout.js
flok-0.0.60 app/kern/callout.js
flok-0.0.57 app/kern/callout.js
flok-0.0.56 app/kern/callout.js
flok-0.0.55 app/kern/callout.js
flok-0.0.54 app/kern/callout.js
flok-0.0.53 app/kern/callout.js
flok-0.0.52 app/kern/callout.js
flok-0.0.51 app/kern/callout.js
flok-0.0.50 app/kern/callout.js
flok-0.0.49 app/kern/callout.js
flok-0.0.48 app/kern/callout.js
flok-0.0.47 app/kern/callout.js
flok-0.0.45 app/kern/callout.js
flok-0.0.44 app/kern/callout.js
flok-0.0.43 app/kern/callout.js
flok-0.0.42 app/kern/callout.js