Sha256: 9cee1d165224b73cecbc38ffccef69ad364aa7ef161aff8f2529b578725f0517

Contents?: true

Size: 504 Bytes

Versions: 5

Compression:

Stored size: 504 Bytes

Contents

"use strict";

function send(packet) {
  var event = document.createEvent("CustomEvent")
  event.initCustomEvent("client", false, true, packet)
  window.dispatchEvent(event)
}

function server() {
  var Out = window.Out = []
  window.addEventListener("server", function(event) {
    var packet = event.detail
    try { Out[packet.to] = window.eval(packet.source) }
    catch (error) { Out[packet.to] = error }
    send({ from: packet.to, message: Out[packet.to] })
  }, false)
}

module.exports = server

Version data entries

5 entries across 2 versions & 1 rubygems

Version Path
ruby-wisp-source-0.8.0 vendor/interactivate/node_modules/interactivate/host/window.js
ruby-wisp-source-0.8.0 vendor/node_modules/wisp/interactivate/node_modules/interactivate/host/window.js
ruby-wisp-source-0.7.0 vendor/interactivate/node_modules/interactivate/host/window.js
ruby-wisp-source-0.7.0 vendor/node_modules/wisp/interactivate/node_modules/interactivate/host/window.js
ruby-wisp-source-0.7.0 vendor/try/node_modules/~wisp/interactivate/node_modules/interactivate/host/window.js