Comparing version 1.3.9 to 1.3.10
{ | ||
"name": "PubSubJS", | ||
"version": "1.3.9", | ||
"version": "1.3.10", | ||
"main": "src/pubsub.js", | ||
@@ -5,0 +5,0 @@ "ignore": [ |
{ | ||
"name": "pubsub-js", | ||
"version": "1.3.9", | ||
"description": "Dependency free publish/subscribe library", | ||
"main": "./src/pubsub.js", | ||
"directories": { | ||
"lib": "src", | ||
"test": "test" | ||
}, | ||
"scripts": { | ||
"test": "grunt test" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/mroderick/PubSubJS.git" | ||
}, | ||
"keywords": [ | ||
"pub/sub", | ||
"pubsub", | ||
"publish/subscribe", | ||
"publish", | ||
"subscribe" | ||
], | ||
"author": { | ||
"name": "Morgan Roderick", | ||
"email": "morgan@roderick.dk", | ||
"url": "http://roderick.dk" | ||
}, | ||
"license": "MIT", | ||
"devDependencies": { | ||
"buster": "0.6.x", | ||
"grunt": "0.4.0", | ||
"grunt-jslint": "0.2.5", | ||
"grunt-buster": "0.1.2" | ||
} | ||
"name": "pubsub-js", | ||
"version": "1.3.10", | ||
"description": "Dependency free publish/subscribe library", | ||
"main": "./src/pubsub.js", | ||
"directories": { | ||
"lib": "src", | ||
"test": "test" | ||
}, | ||
"scripts": { | ||
"test": "grunt test" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/mroderick/PubSubJS.git" | ||
}, | ||
"keywords": [ | ||
"pub/sub", | ||
"pubsub", | ||
"publish/subscribe", | ||
"publish", | ||
"subscribe" | ||
], | ||
"author": { | ||
"name": "Morgan Roderick", | ||
"email": "morgan@roderick.dk", | ||
"url": "http://roderick.dk" | ||
}, | ||
"license": "MIT", | ||
"devDependencies": { | ||
"buster": "0.6.x", | ||
"grunt": "0.4.0", | ||
"grunt-jslint": "0.2.5", | ||
"grunt-buster": "0.1.2" | ||
} | ||
} |
@@ -175,3 +175,3 @@ # PubSubJS | ||
// add a subscription | ||
var token = $.pubsub('subscribe', topic, sayHello ); | ||
var token = $.pubsub('subscribe', topic, subscriber ); | ||
@@ -178,0 +178,0 @@ // unsubscribing |
@@ -21,3 +21,3 @@ /* | ||
// CommonJS | ||
if (typeof exports === 'object'){ | ||
if (typeof exports === 'object' && module){ | ||
module.exports = factory(); | ||
@@ -157,2 +157,6 @@ | ||
PubSub.subscribe = function( message, func ){ | ||
if ( typeof func !== 'function'){ | ||
return false; | ||
} | ||
// message is not registered yet | ||
@@ -206,2 +210,2 @@ if ( !messages.hasOwnProperty( message ) ){ | ||
return PubSub; | ||
})); | ||
})); |
@@ -6,2 +6,3 @@ /*jslint white:true, plusplus:true */ | ||
assert, | ||
refute, | ||
require, | ||
@@ -73,3 +74,29 @@ sinon | ||
// make sure all tokens are different | ||
TestHelper.assertAllTokensDifferent( tokens ); | ||
TestHelper.assertAllTokensDifferent( tokens ); | ||
}, | ||
'should return false when subscriber argument is not a function' : function(){ | ||
var invalidSubscribers = [undefined, null, 'a string', 123, [], {}, new Date()], | ||
topic = TestHelper.getUniqueString(), | ||
i; | ||
for ( i = 0; i < invalidSubscribers.length; i++ ){ | ||
assert.equals(PubSub.subscribe(topic, invalidSubscribers[i]), false); | ||
} | ||
assert.equals(i, invalidSubscribers.length); | ||
}, | ||
'must not throw errors when publishing with invalid subscribers' : function(){ | ||
var invalidSubscribers = [undefined, null, 'a string', 123, [], {}, new Date()], | ||
topic = TestHelper.getUniqueString(), | ||
i; | ||
for (i = 0; i < invalidSubscribers.length; i++){ | ||
PubSub.subscribe(topic, invalidSubscribers[i]); | ||
} | ||
refute.exception(function(){ | ||
PubSub.publish(topic, TestHelper.getUniqueString()); | ||
}); | ||
} | ||
@@ -76,0 +103,0 @@ }); |
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
298230
27
8670