Sha256: b252b1dafeb47c824c8a2e8afcfad9ed67027b5207cbb692b15d56a2675d95f8

Contents?: true

Size: 1.06 KB

Versions: 32

Compression:

Stored size: 1.06 KB

Contents

<% if @debug %>
function pg_net_sim_init(ns, options) {
  pg_net_sim_spec_did_init = true;
  pg_net_sim_ns = ns;

  //Set timer to tick every 2 seconds
  reg_evt(-9393, pg_net_sim_tick_handler);
  reg_interval(-9393, "tick", 4*2);

  pg_net_sim_waiting_for_response = [];
}

function pg_net_sim_tick_handler(ep, ename, info) {
  while (pg_net_sim_waiting_for_response.length > 0) {
    var e = pg_net_sim_waiting_for_response.shift();
    vm_cache_write(pg_net_sim_ns, pg_net_sim_stored_pages[e.id]);
  }
}

function pg_net_sim_watch(id, page) {
  if (pg_net_sim_stored_pages[id] === undefined) {
    throw "Could not get page with id: " + id;
  }

  pg_net_sim_waiting_for_response.push({id: id});
}

function pg_net_sim_unwatch(id) {
}

function pg_net_sim_write(page) {
  vm_cache_write(pg_net_sim_ns, page);
}

//Special support function to simulate pages stored
//on a server
pg_net_sim_stored_pages = {};
function pg_net_sim_load_pages(pages) {
  for (var i = 0; i < pages.length; ++i) {
    var page = pages[i];
    pg_net_sim_stored_pages[page._id] = page;
  }
}
<% end %>

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
flok-0.0.75 app/kern/pagers/pg_net_sim.js
flok-0.0.74 app/kern/pagers/pg_net_sim.js
flok-0.0.73 app/kern/pagers/pg_net_sim.js
flok-0.0.72 app/kern/pagers/pg_net_sim.js
flok-0.0.71 app/kern/pagers/pg_net_sim.js
flok-0.0.70 app/kern/pagers/pg_net_sim.js
flok-0.0.69 app/kern/pagers/pg_net_sim.js
flok-0.0.68 app/kern/pagers/pg_net_sim.js
flok-0.0.67 app/kern/pagers/pg_net_sim.js
flok-0.0.66 app/kern/pagers/pg_net_sim.js
flok-0.0.65 app/kern/pagers/pg_net_sim.js
flok-0.0.64 app/kern/pagers/pg_net_sim.js
flok-0.0.63 app/kern/pagers/pg_net_sim.js
flok-0.0.62 app/kern/pagers/pg_net_sim.js
flok-0.0.61 app/kern/pagers/pg_net_sim.js
flok-0.0.60 app/kern/pagers/pg_net_sim.js
flok-0.0.57 app/kern/pagers/pg_net_sim.js
flok-0.0.56 app/kern/pagers/pg_net_sim.js
flok-0.0.55 app/kern/pagers/pg_net_sim.js
flok-0.0.54 app/kern/pagers/pg_net_sim.js