index.js
function defer(timeout) {
    var resolve, reject;
    var promise = new Promise(function() {
        resolve = arguments[0];
        reject = arguments[1];
        setTimeout(reject, timeout, "Timeout");
    });
    return {
        resolve: resolve,
        reject: reject,
        promise: promise,
        timestamp:new Date().getTime()
    };
}
function defer(timeout) {
    var resolve, reject;
    var promise = new Promise(function() {
        resolve = arguments[0];
        reject = arguments[1];
        setTimeout(reject, timeout, "Timeout");
    });
    return {
        resolve: resolve,
        reject: reject,
        promise: promise,
        timestamp:new Date().getTime()
    };
}
function defer ( timeout ) { var resolve , reject ; var promise = new Promise ( function ( ) { resolve = arguments [ 0 ] ; reject = arguments [ 1 ] ; setTimeout ( reject , timeout , "Timeout" ) ; } ) ; return { resolve : resolve , reject : reject , promise : promise , timestamp : new Date ( ) . getTime ( ) } ; }
defer is discourage in most promise library so we define one for this particular situation
defer is discourage in most promise library so we define one for this particular situation