Updated SubscriptionDefinition's debounce to use strategy. Removed factory method call on CommonJS import in tests

This commit is contained in:
ifandelse 2014-01-26 02:25:42 -05:00
parent 72388c6ae8
commit c34650abc5
9 changed files with 9 additions and 11 deletions

View file

@ -280,8 +280,7 @@
if (_.isNaN(milliseconds)) {
throw "Milliseconds must be a number";
}
var fn = this.callback;
this.callback = _.debounce(fn, milliseconds, !! immediate);
this.callback.useStrategy(postal.configuration.strategies.debounce(milliseconds, immediate));
return this;
},

2
lib/postal.min.js vendored

File diff suppressed because one or more lines are too long

View file

@ -1,6 +1,6 @@
/* global describe, postal, it, after, before, expect */
(function(){
var postal = typeof window === "undefined" ? require("../lib/postal.js")() : window.postal;
var postal = typeof window === "undefined" ? require("../lib/postal.js") : window.postal;
var expect = typeof window === "undefined" ? require("expect.js") : window.expect;
var bindingsResolver = postal.configuration.resolver;
describe( "amqpBindingsResolver", function () {

View file

@ -1,6 +1,6 @@
/* global describe, postal, it, after, before, expect */
(function(){
var postal = typeof window === "undefined" ? require("../lib/postal.js")() : window.postal;
var postal = typeof window === "undefined" ? require("../lib/postal.js") : window.postal;
var expect = typeof window === "undefined" ? require("expect.js") : window.expect;
var ChannelDefinition = postal.ChannelDefinition;
describe( "channel definition", function () {

View file

@ -1,6 +1,6 @@
/* global describe, postal, it, after, before, expect */
(function() {
var postal = typeof window === "undefined" ? require("../lib/postal.js")() : window.postal;
var postal = typeof window === "undefined" ? require("../lib/postal.js") : window.postal;
var expect = typeof window === "undefined" ? require("expect.js") : window.expect;
var subscription;
describe("linked channels", function () {

View file

@ -1,6 +1,6 @@
/* global describe, postal, it, after, before, expect */
(function(global) {
var postal = typeof window === "undefined" ? require("../lib/postal.js")() : window.postal;
var postal = typeof window === "undefined" ? require("../lib/postal.js") : window.postal;
var expect = typeof window === "undefined" ? require("expect.js") : window.expect;
var _ = typeof window === "undefined" ? require("underscore") : window._;
var subscription;

View file

@ -1,6 +1,6 @@
/* global describe, postal, it, after, before, expect */
(function() {
var postal = typeof window === "undefined" ? require("../lib/postal.js")() : window.postal;
var postal = typeof window === "undefined" ? require("../lib/postal.js") : window.postal;
var expect = typeof window === "undefined" ? require("expect.js") : window.expect;
var NO_OP = function () {};
var SubscriptionDefinition = postal.SubscriptionDefinition;

View file

@ -1,6 +1,6 @@
/* global describe, postal, it, after, before, expect */
(function() {
var postal = typeof window === "undefined" ? require("../lib/postal.js")() : window.postal;
var postal = typeof window === "undefined" ? require("../lib/postal.js") : window.postal;
var expect = typeof window === "undefined" ? require("expect.js") : window.expect;
var _ = typeof window === "undefined" ? require("underscore") : window._;
var NO_OP = function() {};

View file

@ -68,8 +68,7 @@ SubscriptionDefinition.prototype = {
if ( _.isNaN( milliseconds ) ) {
throw "Milliseconds must be a number";
}
var fn = this.callback;
this.callback = _.debounce( fn, milliseconds, !!immediate );
this.callback.useStrategy(postal.configuration.strategies.debounce(milliseconds, immediate));
return this;
},