Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Deleted CoffeeScript source.

  • Loading branch information...
commit f9e487860d390f84ad3971ffbea6c03331d77591 1 parent c148aab
@jprichardson authored
Showing with 2 additions and 45 deletions.
  1. +2 −2 README.md
  2. +0 −43 src/triggerflow.coffee
View
4 README.md
@@ -38,7 +38,7 @@ Revisiting the previous example, you can solve this problem quite easily with a
In `triggerflow`, base conditions are when a `boolean` is `true` and when a `number` is `0`.
-Example:
+**Example:**
```javascript
var trigger = require('triggerflow');
@@ -50,7 +50,7 @@ walk('~/data')
.on('file', function(file) {
processing += 1;
tf.update({processing: processing});
- processFile(function() { //hypothetical async file process function
+ processFile(file, function() { //hypothetical async file process function
processing -= 1;
tf.update({processing: processing});
})
View
43 src/triggerflow.coffee
@@ -1,43 +0,0 @@
-class TriggerFlow
- constructor: ->
- @callback = ->
- @object = {}
- @hasTriggered = false
-
- update: (partialObject) =>
- for key,val of partialObject
- #console.log "pobj: #{key},#{val}"
- if partialObject.hasOwnProperty(key)
- if typeof val is 'number'
- if val < 0 #should just decrement
- @object[key] = @object[key] + val
- else
- @object[key] = val
- else
- @object[key] = val
-
- allTrue = true
- for key,val of @object
- #console.log "wobj: #{key},#{val}"
- if @object.hasOwnProperty(key)
- if typeof val is 'boolean'
- allTrue &= val
- if typeof val is 'number'
- allTrue &= (val is 0)
- if !allTrue
- #console.log 'not all true'
- return
- #if we're here, they're allTrue
- @hasTriggered = true
- args = []
- Array.prototype.push.apply(args, arguments)
- args.shift() #cut partialObject out
- if @callback? then @callback.apply(null, args)
-
- @create: (object, callback) ->
- tf = new TriggerFlow()
- tf.callback = callback
- tf.object = object
- tf
-
-module.exports.TriggerFlow = TriggerFlow
Please sign in to comment.
Something went wrong with that request. Please try again.