Sha256: 55105d2c7cd91ac216b59b786319a2d5a24b95cac455b350ed9a5a72452c295c

Contents?: true

Size: 1.62 KB

Versions: 31

Compression:

Stored size: 1.62 KB

Contents

<% if @defines['sockio_pager'] %>
  sockio_pager_data = {};

  sockio_pager_sp = null;
  sockio_pager_bp = null;
  waiting_bp = null;
  function sockio_pager_init(options) {
    sockio_pager_sp = tels(1);
    sockio_pager_bp = tels(1);
    SEND("main", "if_sockio_init", options.url, sockio_pager_sp);
    reg_evt(sockio_pager_bp, sockio_pager_sp_endpoint);
    SEND("async", "if_sockio_fwd", sockio_pager_sp, "read_res", sockio_pager_bp);
    SEND("async", "if_sockio_fwd", sockio_pager_sp, "notify", sockio_pager_bp);
  }

  function sockio_pager_read_sync(ns, bp, key) {
    throw "sockio_pager does not support read_sync"
  }

  function sockio_pager_read(ns, bp, key) {
    var info = {
      key: key,
      bp: bp
    }

    SEND("async", "if_sockio_send", sockio_pager_sp, "read", info);

    waiting_bp = bp;
  }

  function sockio_pager_write(key, value) {
    throw "sockio_pager does not support write"
  }

  //Where socket.io data comes in
  function sockio_pager_sp_endpoint(ep, ename, info) {
    if (ename === "read_res") {
      var bp = info.bp;
      var key = info.key;
      var value = info.value;
      int_event(waiting_bp, "read_res", info);
      vm_cache_write("net", key, value);
    } else if (ename === "notify") {
      var key = info.key;
      vm_notify("net", key);
    }
  }

  function sockio_pager_watch(ns, key) {
    var info = {
      ns: ns,
      key: key
    }
    SEND("async", "if_sockio_send", sockio_pager_sp, "watch", info);
  }

  function sockio_pager_unwatch(ns, key) {
    var info = {
      ns: ns,
      key: key
    }
    SEND("async", "if_sockio_send", sockio_pager_sp, "unwatch", info);
  }


<% end %>

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
flok-0.0.71 app/kern/pagers/sockio_pager.js
flok-0.0.70 app/kern/pagers/sockio_pager.js
flok-0.0.69 app/kern/pagers/sockio_pager.js
flok-0.0.68 app/kern/pagers/sockio_pager.js
flok-0.0.67 app/kern/pagers/sockio_pager.js
flok-0.0.66 app/kern/pagers/sockio_pager.js
flok-0.0.65 app/kern/pagers/sockio_pager.js
flok-0.0.64 app/kern/pagers/sockio_pager.js
flok-0.0.63 app/kern/pagers/sockio_pager.js
flok-0.0.62 app/kern/pagers/sockio_pager.js
flok-0.0.61 app/kern/pagers/sockio_pager.js
flok-0.0.60 app/kern/pagers/sockio_pager.js
flok-0.0.57 app/kern/pagers/sockio_pager.js
flok-0.0.56 app/kern/pagers/sockio_pager.js
flok-0.0.55 app/kern/pagers/sockio_pager.js
flok-0.0.54 app/kern/pagers/sockio_pager.js
flok-0.0.53 app/kern/pagers/sockio_pager.js
flok-0.0.52 app/kern/pagers/sockio_pager.js
flok-0.0.51 app/kern/pagers/sockio_pager.js
flok-0.0.50 app/kern/pagers/sockio_pager.js