Comparing version 0.2.0 to 0.2.1
@@ -109,3 +109,3 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Minijanus = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
var handlers = this.txns[signal.transaction]; | ||
if (signal.janus === "ack" && signal.hint) { | ||
if (signal.janus === "ack") { | ||
// this is an ack of an asynchronously-processed request, we should wait | ||
@@ -112,0 +112,0 @@ // to resolve the promise until the actual response comes in |
@@ -108,3 +108,3 @@ /** Whether to log information about incoming and outgoing Janus signals. **/ | ||
var handlers = this.txns[signal.transaction]; | ||
if (signal.janus === "ack" && signal.hint) { | ||
if (signal.janus === "ack") { | ||
// this is an ack of an asynchronously-processed request, we should wait | ||
@@ -111,0 +111,0 @@ // to resolve the promise until the actual response comes in |
{ | ||
"name": "minijanus", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "Really simple and minimal wrapper for talking to the Janus signalling API.", | ||
@@ -5,0 +5,0 @@ "main": "minijanus.js", |
20
tests.js
@@ -11,2 +11,6 @@ var mj = require('./minijanus.js'); | ||
session.receive({ transaction: "figs", janus: "ack" }); | ||
session.receive({ transaction: "wigs", janus: "ack" }); | ||
session.receive({ transaction: "pigs", janus: "ack", hint: "Asynchronously processing some pigs." }); | ||
session.receive({ transaction: "pigs", rats: "pats" }); | ||
@@ -31,13 +35,17 @@ session.receive({ just: "kidding" }); | ||
var aq = session.send({ transaction: "lazy" }).then( | ||
resp => t.error(true, "Request should have failed!"), | ||
err => t.ok(true, "Timeout should have fired!") | ||
resp => { t.fail("Request should have failed!"); return resp; }, | ||
err => { t.pass("Timeout should have fired!"); return err; } | ||
); | ||
var bq = session.send({ transaction: "hasty" }).then( | ||
resp => t.ok(true, "Request should have succeeded!"), | ||
err => t.error(true, "Timeout shouldn't have fired!") | ||
resp => { t.pass("Request should have succeeded!"); return resp; }, | ||
err => { t.fail("Timeout shouldn't have fired!"); return err; } | ||
); | ||
setTimeout(() => session.receive({ transaction: "hasty", "phew": "just-in-time" }, 1)); | ||
session.receive({ transaction: "lazy", janus: "ack" }); | ||
session.receive({ transaction: "hasty", janus: "ack" }); | ||
Promise.all([aq, bq]).then(() => { | ||
setTimeout(() => session.receive({ transaction: "hasty", phew: "just-in-time" }, 1)); | ||
Promise.all([aq, bq]).then(results => { | ||
t.deepEqual(results[1], { transaction: "hasty", phew: "just-in-time" }); | ||
t.deepEqual(session.txns, {}); | ||
@@ -44,0 +52,0 @@ t.end(); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
68375
351