Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

* all worked, before Cakefile re-write

  • Loading branch information...
commit 7051addc3c6e98511c8ef2fbcd5384b8bdbe63c7 1 parent c10f000
@Meettya authored
View
3  .travis.yml
@@ -1,4 +1,5 @@
language: node_js
node_js:
- 0.6
- - 0.8
+ - 0.8
+ - 0.10
View
2  IDEA.md
@@ -8,4 +8,4 @@
не круши схему с точным соответствием, просто добавь еще один или несколько словарей, типа _subscribtion_with_wildcard_ и ищи в них следуюшим шагом, перед вызовом unsubscribe, ну может быть сначала раздели топики на нормальные и странные, так ты не сильно сольеш в скорости, и сможешь прикрутить фичу малой кровью.
-Правдв еще отмена подписки будет веселой, мда.
+Правда еще отмена подписки будет веселой, мда.
View
1  index.js
@@ -1 +0,0 @@
-module.exports = require( './lib/dendrite' );
View
450 lib/dendrite.js
@@ -1,9 +1,9 @@
-// Generated by CoffeeScript 1.3.3
+// Generated by CoffeeScript 1.6.2
(function() {
- var Dendrite, _, _ref,
+ var Dendrite, _,
__slice = [].slice;
- _ = (_ref = this._) != null ? _ref : require('underscore');
+ _ = require('lodash');
/*
**dendrite** - An extended Observer pattern implementation, worked at any JavaScript environment.
@@ -29,18 +29,18 @@
SILENT = 0;
/*
- Construct a new Dendrite.
-
- @example
- dendrite_obj = new Dendrite verbose : 'warning'
-
- @overload constructor()
- Construct new Dendrite with default options
-
- @overload constructor(options)
- Constrict new Dendrite with settings
- @param [Object] options
- @option options [String] verbose verbose level, may be [ 'debug' | 'warning' | 'error' | 'silent' ]
+ Construct a new Dendrite.
+
+ @example
+ dendrite_obj = new Dendrite verbose : 'warning'
+
+ @overload constructor()
+ Construct new Dendrite with default options
+
+ @overload constructor(options)
+ Constrict new Dendrite with settings
+ @param [Object] options
+ @option options [String] verbose verbose level, may be [ 'debug' | 'warning' | 'error' | 'silent' ]
*/
@@ -57,27 +57,27 @@
}
/*
- Subscribe to topic(s).
-
- @note The 'callback' function receives 'topic' [String] as first argument and 'data' [Any] as any data that the publisher sent
-
- @example
- handler = dendrite_obj.subscribe 'foo', (topic, data...) -> console.log data, topic
-
- @overload subscribe(topics, callback)
- Subscribe to topic(s) without context
- @param topics [String] 1 or more topic names, separated by a space, to subscribe to
- @param callback [Function] function to be called when the given topic(s) is published to
- @return [Object]
-
- @overload subscribe(topics, callback, context)
- Subscribe to topic(s) with context
- @param topics [String] 1 or more topic names, separated by a space, to subscribe to
- @param callback [Function] function to be called when the given topic(s) is published to
- @param context [Object] an object to call the function on
- @return [Object]
-
- @return [Object] handler { topics: topics, callback: callback, watchdog: undefined, context: context } or throw exception on invalid arguments
+ Subscribe to topic(s).
+
+ @note The 'callback' function receives 'topic' [String] as first argument and 'data' [Any] as any data that the publisher sent
+
+ @example
+ handler = dendrite_obj.subscribe 'foo', (topic, data...) -> console.log data, topic
+
+ @overload subscribe(topics, callback)
+ Subscribe to topic(s) without context
+ @param topics [String] 1 or more topic names, separated by a space, to subscribe to
+ @param callback [Function] function to be called when the given topic(s) is published to
+ @return [Object]
+
+ @overload subscribe(topics, callback, context)
+ Subscribe to topic(s) with context
+ @param topics [String] 1 or more topic names, separated by a space, to subscribe to
+ @param callback [Function] function to be called when the given topic(s) is published to
+ @param context [Object] an object to call the function on
+ @return [Object]
+
+ @return [Object] handler { topics: topics, callback: callback, watchdog: undefined, context: context } or throw exception on invalid arguments
*/
@@ -89,57 +89,58 @@
};
/*
- Subscribe to topic(s) with 'watchdog' function to handle errors here, in subscriber.
-
- @note The 'callback' function receives 'topic' [String] as first argument and 'data' [Any] as any data that the publisher sent
+ Subscribe to topic(s) with 'watchdog' function to handle errors here, in subscriber.
+
+ @note The 'callback' function receives 'topic' [String] as first argument and 'data' [Any] as any data that the publisher sent
+
+ @note The 'watchdog' function receives two arguments: 'err' [Error] and 'options' [Object] as all 'callback' properties
+
+ @example
+ context_object =
+ name : 'Context Object'
+ callback : (topic, data) -> throw Error "Die at #{topic}"
+ watchdog : (err, options) ->
+ console.log "Error in | #{@name} |"
+ console.log "Error string: | #{err} |"
+ console.log "Error detail", options
+ null
- @note The 'watchdog' function receives two arguments: 'err' [Error] and 'options' [Object] as all 'callback' properties
-
- @example
- context_object =
- name : 'Context Object'
- callback : (topic, data) -> throw Error "Die at #{topic}"
- watchdog : (err, options) ->
- console.log "Error in | #{@name} |"
- console.log "Error string: | #{err} |"
- console.log "Error detail", options
- null
-
- handler = dendrite_obj.subscribeGuarded 'foo', context_object.callback, context_object.watchdog, context_object
-
- @overload subscribeGuarded(topics, callback, watchdog)
- Subscribe with 'watchdog' without context
- @param topics [String] 1 or more topic names, separated by a space, to subscribe to
- @param callback [Function] function to be called when the given topic(s) is published to
- @param watchdog [Function] function to be called when callback under publishing topic rise exception
- @return [Object]
-
- @overload subscribeGuarded(topics, callback, watchdog, context)
- Subscribe with 'watchdog' with context
- @param topics [String] 1 or more topic names, separated by a space, to subscribe to
- @param callback [Function] function to be called when the given topic(s) is published to
- @param watchdog [Function] function to be called when callback under publishing topic rise exception
- @param context [Object] an object to call the function on
- @return [Object]
-
- @see #subscribe
- @return [Object] handler { topics: topics, callback: callback, watchdog: watchdog, context: context } or throw exception on invalid arguments
+ handler = dendrite_obj.subscribeGuarded 'foo', context_object.callback, context_object.watchdog, context_object
+
+ @overload subscribeGuarded(topics, callback, watchdog)
+ Subscribe with 'watchdog' without context
+ @param topics [String] 1 or more topic names, separated by a space, to subscribe to
+ @param callback [Function] function to be called when the given topic(s) is published to
+ @param watchdog [Function] function to be called when callback under publishing topic rise exception
+ @return [Object]
+
+ @overload subscribeGuarded(topics, callback, watchdog, context)
+ Subscribe with 'watchdog' with context
+ @param topics [String] 1 or more topic names, separated by a space, to subscribe to
+ @param callback [Function] function to be called when the given topic(s) is published to
+ @param watchdog [Function] function to be called when callback under publishing topic rise exception
+ @param context [Object] an object to call the function on
+ @return [Object]
+
+ @see #subscribe
+ @return [Object] handler { topics: topics, callback: callback, watchdog: watchdog, context: context } or throw exception on invalid arguments
*/
Dendrite.prototype.subscribeGuarded = function(topics, callback, watchdog, context) {
- var task_number, topic, _base, _i, _len, _ref1;
+ var task_number, topic, _base, _i, _len, _ref;
+
if (context == null) {
context = {};
}
- if (!(_.isString(topics) || _.isFunction(callback) || (!(watchdog != null) || _.isFunction(watchdog)))) {
+ if (!(_.isString(topics) || _.isFunction(callback) || ((watchdog == null) || _.isFunction(watchdog)))) {
throw this._subscribeErrorMessage(topics, callback, watchdog, context);
}
task_number = this._getNextTaskNumber();
this._tasks_dictionary_[task_number] = [callback, context, watchdog];
- _ref1 = this._topicsToArraySplitter(topics);
- for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
- topic = _ref1[_i];
+ _ref = this._topicsToArraySplitter(topics);
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ topic = _ref[_i];
(_base = this._subscriptions_)[topic] || (_base[topic] = []);
this._subscriptions_[topic].push(task_number);
}
@@ -152,51 +153,52 @@
};
/*
- Unsubscribe from topic(s) or remove all subscribers from topic(s).
-
- @note Unsubscriptions may be placed to queue if Dendrite do some publish tasks
- and restarted to unsubscribe when all publish tasks is done.
-
- @example
- # unsubscribe 'obj' from topics 'foo bar'
- dendrite_obj.unsubscribe 'foo bar', callback_reference, obj
- # remove all subscribers from topics 'bar baz'
- dendrite_obj.unsubscribe 'bar baz'
-
- @overload unsubscribe(topics)
- Remove **all** subscriptions from topic(s)
- @param topics [String] 1 or more topic names, separated by a space, to unsubscribe from
- @return [Object]
-
- @overload unsubscribe(topics, callback)
- Remove subscriptions for callback from topic(s) if no context used in the #subscribe() call
- @param topics [String] 1 or more topic names, separated by a space, to unsubscribe from
- @param callback [Function] function to be removed from the topics subscription list
- @return [Object]
-
- @overload unsubscribe(topics, callback, context)
- Remove subscriptions for callback and given context object from topic(s)
- @param topics [String] 1 or more topic names, separated by a space, to unsubscribe from
- @param callback [Function] function to be removed from the topics subscription list
- @param context [Object] object that was used as the context in the #subscribe() call
- @return [Object]
-
- @overload unsubscribe(handler)
- Remove subscriptions with *handler* object. May be usefully if subscription created with anonymous 'callback'
- @param [Object] handler subscription handler, returned by #subscribeX() method
- @option handler [String] topics 1 or more topic names, separated by a space, to unsubscribe from
- @option handler [Function] callback function to be removed from the topics subscription list
- @option handler [Object] context object that was used as the context in the #subscribe() call
- @return [Object]
-
- @return [Object] *this* for chaining
+ Unsubscribe from topic(s) or remove all subscribers from topic(s).
+
+ @note Unsubscriptions may be placed to queue if Dendrite do some publish tasks
+ and restarted to unsubscribe when all publish tasks is done.
+
+ @example
+ # unsubscribe 'obj' from topics 'foo bar'
+ dendrite_obj.unsubscribe 'foo bar', callback_reference, obj
+ # remove all subscribers from topics 'bar baz'
+ dendrite_obj.unsubscribe 'bar baz'
+
+ @overload unsubscribe(topics)
+ Remove **all** subscriptions from topic(s)
+ @param topics [String] 1 or more topic names, separated by a space, to unsubscribe from
+ @return [Object]
+
+ @overload unsubscribe(topics, callback)
+ Remove subscriptions for callback from topic(s) if no context used in the #subscribe() call
+ @param topics [String] 1 or more topic names, separated by a space, to unsubscribe from
+ @param callback [Function] function to be removed from the topics subscription list
+ @return [Object]
+
+ @overload unsubscribe(topics, callback, context)
+ Remove subscriptions for callback and given context object from topic(s)
+ @param topics [String] 1 or more topic names, separated by a space, to unsubscribe from
+ @param callback [Function] function to be removed from the topics subscription list
+ @param context [Object] object that was used as the context in the #subscribe() call
+ @return [Object]
+
+ @overload unsubscribe(handler)
+ Remove subscriptions with *handler* object. May be usefully if subscription created with anonymous 'callback'
+ @param [Object] handler subscription handler, returned by #subscribeX() method
+ @option handler [String] topics 1 or more topic names, separated by a space, to unsubscribe from
+ @option handler [Function] callback function to be removed from the topics subscription list
+ @option handler [Object] context object that was used as the context in the #subscribe() call
+ @return [Object]
+
+ @return [Object] *this* for chaining
*/
Dendrite.prototype.unsubscribe = function(topics, callback, context) {
- var idx, task, task_number, topic, _i, _j, _len, _len1, _ref1, _ref2, _ref3;
+ var idx, task, task_number, topic, _i, _j, _len, _len1, _ref, _ref1, _ref2;
+
if (topics.topics) {
- _ref1 = this._handlerParser(topics, callback, context), topics = _ref1[0], callback = _ref1[1], context = _ref1[2];
+ _ref = this._handlerParser(topics, callback, context), topics = _ref[0], callback = _ref[1], context = _ref[2];
}
context || (context = {});
if (!_.isString(topics)) {
@@ -207,20 +209,20 @@
return this;
}
/*
- IMPORTANT! Yes, we are remove subscriptions ONLY,
- and keep tasks_dictionary untouched because its not necessary.
- Dictionary compacted, calculations of links to dictionary from subscriptions
- may be nightmare - its like pointers in C, exceptionally funny in async mode.
- So, who get f*ck about this? Not me!!!
+ IMPORTANT! Yes, we are remove subscriptions ONLY,
+ and keep tasks_dictionary untouched because its not necessary.
+ Dictionary compacted, calculations of links to dictionary from subscriptions
+ may be nightmare - its like pointers in C, exceptionally funny in async mode.
+ So, who get f*ck about this? Not me!!!
*/
- _ref2 = this._topicsToArraySplitter(topics);
- for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
- topic = _ref2[_i];
+ _ref1 = this._topicsToArraySplitter(topics);
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ topic = _ref1[_i];
if (_.isFunction(callback)) {
- _ref3 = this._subscriptions_[topic];
- for (idx = _j = 0, _len1 = _ref3.length; _j < _len1; idx = ++_j) {
- task_number = _ref3[idx];
+ _ref2 = this._subscriptions_[topic];
+ for (idx = _j = 0, _len1 = _ref2.length; _j < _len1; idx = ++_j) {
+ task_number = _ref2[idx];
if (task = this._tasks_dictionary_[task_number]) {
if (_.isEqual([task[0], task[1]], [callback, context])) {
this._subscriptions_[topic].splice(idx, 1);
@@ -235,75 +237,78 @@
};
/*
- Synchronously publish any data to topic(s).
-
- @example
- dendrite_obj.publish 'foo bar', 'This is some data'
-
- @overload publish(topics)
- Do publish to topics without any data
- @param topics [String] 1 or more topic names, separated by a space, to publish to
- @return [Object]
-
- @overload publish(topics, data...)
- Do publish with some data to topics
- @param topics [String] 1 or more topic names, separated by a space, to publish to
- @param data [Any] any kind of data(s) you wish to give to the subscribers
- @return [Object]
-
- @return [Object] *this* for chaining
+ Synchronously publish any data to topic(s).
+
+ @example
+ dendrite_obj.publish 'foo bar', 'This is some data'
+
+ @overload publish(topics)
+ Do publish to topics without any data
+ @param topics [String] 1 or more topic names, separated by a space, to publish to
+ @return [Object]
+
+ @overload publish(topics, data...)
+ Do publish with some data to topics
+ @param topics [String] 1 or more topic names, separated by a space, to publish to
+ @param data [Any] any kind of data(s) you wish to give to the subscribers
+ @return [Object]
+
+ @return [Object] *this* for chaining
*/
Dendrite.prototype.publish = function() {
var data, topics;
+
topics = arguments[0], data = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
this._publisher('sync', topics, data);
return this;
};
/*
- Alias for {#publish}
- @return [Object] *this* for chaining
+ Alias for {#publish}
+ @return [Object] *this* for chaining
*/
Dendrite.prototype.publishSync = function() {
var data, topics;
+
topics = arguments[0], data = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
this._publisher('sync', topics, data);
return this;
};
/*
- Asynchronously publish any data to topic(s).
-
- @note Used exactly as {#publish}, but this method puts task to queue and will returns immediately
-
- @example
- dendrite_obj.publishAsync 'foo bar', 'This is some data'
-
- See {#publish} for all info
- @return [Object] *this* for chaining
+ Asynchronously publish any data to topic(s).
+
+ @note Used exactly as {#publish}, but this method puts task to queue and will returns immediately
+
+ @example
+ dendrite_obj.publishAsync 'foo bar', 'This is some data'
+
+ See {#publish} for all info
+ @return [Object] *this* for chaining
*/
Dendrite.prototype.publishAsync = function() {
var data, topics;
+
topics = arguments[0], data = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
this._publisher('async', topics, data);
return this;
};
/*
- !!!! Internal methods from now !!!!
+ !!!! Internal methods from now !!!!
*/
/*
- Self-incapsulate @_publishing_counter_ properties to internal methods
- @private
- @return [Boolean] true if Dendrite is publishing, false is idle
+ Self-incapsulate @_publishing_counter_ properties to internal methods
+ @private
+ @return [Boolean] true if Dendrite is publishing, false is idle
*/
@@ -312,8 +317,8 @@
};
/*
- Self-incapsulate @_publishing_counter_ properties to internal methods
- @private
+ Self-incapsulate @_publishing_counter_ properties to internal methods
+ @private
*/
@@ -323,8 +328,8 @@
};
/*
- Self-incapsulate @_publishing_counter_ properties to internal methods
- @private
+ Self-incapsulate @_publishing_counter_ properties to internal methods
+ @private
*/
@@ -337,9 +342,9 @@
};
/*
- Self-incapsulated task auto-incremented counter
- @private
- @return [Integer] unique task number
+ Self-incapsulated task auto-incremented counter
+ @private
+ @return [Integer] unique task number
*/
@@ -348,10 +353,10 @@
};
/*
- Verbose level args parser
- @private
- @param level [String] verbose level name
- @return [Integer] verbose level
+ Verbose level args parser
+ @private
+ @param level [String] verbose level name
+ @return [Integer] verbose level
*/
@@ -377,15 +382,16 @@
};
/*
- Internal method for different events types definitions
- @private
- @param type [String] engine type name
- @return [Array<publish, unsubscribe>] engine or throw exception on invalid arguments
+ Internal method for different events types definitions
+ @private
+ @param type [String] engine type name
+ @return [Array<publish, unsubscribe>] engine or throw exception on invalid arguments
*/
Dendrite.prototype._publisherEngine = function(type) {
var engine_dictionary, selected_engine, self;
+
self = this;
engine_dictionary = {
sync: {
@@ -413,27 +419,28 @@
};
/*
- Publisher itself
- @private
- @param type [String] engine type name
- @param topics [String] topic names
- @param data [Array] any kind of data(s)
+ Publisher itself
+ @private
+ @param type [String] engine type name
+ @param topics [String] topic names
+ @param data [Array] any kind of data(s)
*/
Dendrite.prototype._publisher = function(type, topics, data) {
- var task_number, topic, _i, _j, _len, _len1, _publish, _ref1, _ref2, _ref3, _unsubscribe;
+ var task_number, topic, _i, _j, _len, _len1, _publish, _ref, _ref1, _ref2, _unsubscribe;
+
if (!_.isString(topics)) {
throw this._publishErrorMessage(topics, data);
}
- _ref1 = this._publisherEngine(type), _publish = _ref1[0], _unsubscribe = _ref1[1];
- _ref2 = this._topicsToArraySplitter(topics, false);
- for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
- topic = _ref2[_i];
+ _ref = this._publisherEngine(type), _publish = _ref[0], _unsubscribe = _ref[1];
+ _ref1 = this._topicsToArraySplitter(topics, false);
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ topic = _ref1[_i];
if (this._subscriptions_[topic]) {
- _ref3 = this._subscriptions_[topic];
- for (_j = 0, _len1 = _ref3.length; _j < _len1; _j++) {
- task_number = _ref3[_j];
+ _ref2 = this._subscriptions_[topic];
+ for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
+ task_number = _ref2[_j];
this._publishingInc();
_publish.call(this, topic, this._tasks_dictionary_[task_number], data);
}
@@ -444,25 +451,26 @@
};
/*
- Internal method for splitting topics string to array.
- @note May skip duplicate (it used for un/subscription )
- @private
- @param topics [String] topic names
- @param skip_duplicate [Boolean] *optional* is it needed to skip duplicate?
- @return [Array<topics>] individual topics
+ Internal method for splitting topics string to array.
+ @note May skip duplicate (it used for un/subscription )
+ @private
+ @param topics [String] topic names
+ @param skip_duplicate [Boolean] *optional* is it needed to skip duplicate?
+ @return [Array<topics>] individual topics
*/
Dendrite.prototype._topicsToArraySplitter = function(topics, skip_duplicate) {
- var topic, used_topics, _i, _len, _ref1, _results;
+ var topic, used_topics, _i, _len, _ref, _results;
+
if (skip_duplicate == null) {
skip_duplicate = true;
}
used_topics = {};
- _ref1 = topics.split(' ');
+ _ref = topics.split(' ');
_results = [];
- for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
- topic = _ref1[_i];
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ topic = _ref[_i];
if (!(topic !== '')) {
continue;
}
@@ -476,17 +484,18 @@
};
/*
- Internal method for handler parser
- @private
- @param handler [Object] handler
- @param callback [Function] *optional*
- @param context [Object] *optional*
- @return [Array<topics, callback, context>] parsed handler
+ Internal method for handler parser
+ @private
+ @param handler [Object] handler
+ @param callback [Function] *optional*
+ @param context [Object] *optional*
+ @return [Array<topics, callback, context>] parsed handler
*/
Dendrite.prototype._handlerParser = function(handler, callback, context) {
var topics;
+
callback || (callback = handler.callback);
context || (context = handler.context);
topics = handler.topics;
@@ -494,13 +503,14 @@
};
/*
- Internal method for unsubscribe continue
- @private
+ Internal method for unsubscribe continue
+ @private
*/
Dendrite.prototype._unsubscribeResume = function() {
var task, _base;
+
if (!this._unsubscribe_queue_.length) {
return;
}
@@ -524,18 +534,20 @@
};
/*
- Internal method for publish firing
- @private
+ Internal method for publish firing
+ @private
*/
Dendrite.prototype._publishFiring = function(topic, task, data) {
- var _ref1;
+ var err, _ref;
+
try {
task[0].apply(task[1], [topic].concat(data));
- } catch (err) {
- if ((_ref1 = task[2]) != null) {
- _ref1.call(task[1], err, {
+ } catch (_error) {
+ err = _error;
+ if ((_ref = task[2]) != null) {
+ _ref.call(task[1], err, {
topic: topic,
callback: task[0],
object: task[1],
@@ -554,9 +566,9 @@
};
/*
- Internal method for publish error message constructor
- @private
- @return [Object] Error
+ Internal method for publish error message constructor
+ @private
+ @return [Object] Error
*/
@@ -565,9 +577,9 @@
};
/*
- Internal method for unsubscribe error message constructor
- @private
- @return [Object] Error
+ Internal method for unsubscribe error message constructor
+ @private
+ @return [Object] Error
*/
@@ -587,9 +599,9 @@
};
/*
- Internal method for error message from verbose level parser
- @private
- @return [Object] Error
+ Internal method for error message from verbose level parser
+ @private
+ @return [Object] Error
*/
View
69 package.json
@@ -1,35 +1,36 @@
{
- "name": "dendrite",
- "version": "0.5.5",
- "description": "An extended Observer pattern implementation, worked at any JavaScript environment",
- "keywords": [
- "observer",
- "publish",
- "subscribe",
- "task",
- "async"
- ],
- "author": "Dmitrii Karpich <meettya@gmail.com>",
- "dependencies": {
- "underscore": ">=1.3.3"
- },
- "devDependencies": {
- "coffee-script": ">=1.3.3",
- "chai": "latest",
- "mocha": "latest",
- "jade": "latest",
- "stitch": "latest"
- },
- "scripts": {
- "test": "cake test"
- },
- "repository": {
- "type": "git",
- "url": "https://github.com/Meettya/dendrite.git"
- },
- "main": "index.js",
- "engines": {
- "node": ">=0.6.0"
- },
- "license": "MIT"
-}
+ "name": "dendrite",
+ "version": "0.5.5",
+ "description": "An extended Observer pattern implementation, worked at any JavaScript environment",
+ "keywords": [
+ "observer",
+ "publish",
+ "subscribe",
+ "task",
+ "async"
+ ],
+ "author": "Dmitrii Karpich <meettya@gmail.com>",
+ "dependencies": {
+ "lodash": "*"
+ },
+ "devDependencies": {
+ "coffee-script": "*",
+ "chai": "*",
+ "mocha": "*",
+ "jade": "*",
+ "stitch": "*",
+ "clinch": "*"
+ },
+ "scripts": {
+ "test": "cake test"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/Meettya/dendrite.git"
+ },
+ "main": "./lib/dendrite",
+ "engines": {
+ "node": ">=0.6.0"
+ },
+ "license": "MIT"
+}
View
6 src/dendrite.coffee
@@ -1,5 +1,5 @@
-# resolve require from [window] or by require()
-_ = @_ ? require 'underscore'
+# get fastest
+_ = require 'lodash'
###
**dendrite** - An extended Observer pattern implementation, worked at any JavaScript environment.
@@ -119,7 +119,7 @@ module.exports = class Dendrite
@_subscriptions_[topic] or= []
@_subscriptions_[topic].push task_number
- { topics: topics, callback: callback, watchdog: watchdog, context: context }
+ { topics, callback, watchdog, context }
###
Unsubscribe from topic(s) or remove all subscribers from topic(s).
Please sign in to comment.
Something went wrong with that request. Please try again.