alexa-ability-timeout
Advanced tools
Comparing version 0.2.1 to 0.2.2
@@ -51,13 +51,15 @@ 'use strict'; | ||
// be ready to cancel the timeout | ||
var onSent = function onSent() { | ||
function clearTimeoutWrapper() { | ||
if (!req.timedOut) log('request finished on time'); | ||
clearTimeout(timeout); | ||
}; | ||
req.on('finished', onSent); | ||
req.on('failed', onSent); | ||
} | ||
log('setup timer'); | ||
req.on('finished', clearTimeoutWrapper); | ||
req.on('failed', clearTimeoutWrapper); | ||
req.timedOut = false; | ||
req.clearTimeout = clearTimeoutWrapper; | ||
log('timer setup'); | ||
next(); | ||
}; | ||
} |
{ | ||
"name": "alexa-ability-timeout", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "An alexa-ability middleware to prevent stalled requests.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -52,1 +52,7 @@ # alexa-ability-timeout [![Build Status](https://travis-ci.org/nickclaw/alexa-ability-timeout.svg?branch=master)](https://travis-ci.org/nickclaw/alexa-ability-timeout) | ||
the given `ms` have passed. | ||
##### `req.clearTimeout()` | ||
A function to stop the timeout completely. | ||
##### `req.timedOut` | ||
A boolean indicating whether the request has timed out. |
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
8768
92
58