Skip to content
This repository
Browse code

Merge pull request #139 from scttnlsn/subscribe

Allow job to be subscribed for event mapping
  • Loading branch information...
commit 30ae7ae9c73a4af5f28e917999418f25e12758fd 2 parents d1c1a93 + 502ed7d
TJ Holowaychuk authored

Showing 1 changed file with 13 additions and 1 deletion. Show diff stats Hide diff stats

  1. 14  lib/queue/job.js
14  lib/queue/job.js
@@ -548,7 +548,7 @@ Job.prototype.save = function(fn){
548 548
     self.update(fn);
549 549
 
550 550
     // add the job for event mapping
551  
-    events.add(self);
  551
+    self.subscribe();
552 552
   });
553 553
 
554 554
   return this;
@@ -589,3 +589,15 @@ Job.prototype.update = function(fn){
589 589
   // search data
590 590
   getSearch().index(json, this.id);
591 591
 };
  592
+
  593
+/**
  594
+ * Subscribe this job for event mapping.
  595
+ *
  596
+ * @return {Job} for chaining
  597
+ * @api public
  598
+ */
  599
+
  600
+Job.prototype.subscribe = function(){
  601
+  events.add(this);
  602
+  return this;
  603
+};

0 notes on commit 30ae7ae

Please sign in to comment.
Something went wrong with that request. Please try again.