MCPcopy
hub / github.com/dthree/vantage / on

Function on

lib/server.js:203–215  ·  view source on GitHub ↗
(str, opts, cbk)

Source from the content-addressed store, hash-verified

201 // Listens for an event, authenticating
202 // the session first.
203 function on(str, opts, cbk) {
204 cbk = (_.isFunction(opts)) ? opts : cbk;
205 cbk = cbk || function() {};
206 opts = opts || {};
207 ssn.server.on(str, function() {
208 if (!ssn.server || (!ssn.authenticating && !ssn.authenticated)) {
209 //console.log("Not Authenticated. Closing Session.", ssn.authenticating, ssn.authenticated);
210 self.parent._send("vantage-close-downstream", "downstream", { sessionId: ssn.id });
211 return;
212 }
213 cbk.apply(self, arguments);
214 });
215 }
216
217 on("vantage-keypress-upstream", function(data) {
218 self.parent._proxy("vantage-keypress-upstream", "upstream", data).then(function(){

Callers 1

server.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected