Code coverage report for lib/template/view/transitions.js

Statements: 47.62% (10 / 21)      Branches: 25% (2 / 8)      Functions: 50% (3 / 6)      Lines: 47.06% (8 / 17)      Ignored: none     

All files » lib/template/view/ » transitions.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 501 1         1 12 12           1                           17                   1                      
var protoclass = require("protoclass");
var async      = require("../../utils/async");
 
/**
 */
 
function Transitions() {
  this._enter = [];
  this._exit  = [];
}
 
/**
 */
 
module.exports = protoclass(Transitions, {
 
  /**
   */
 
  push: function(transition) {
    if (transition.enter) this._enter.push(transition);
    if (transition.exit) this._exit.push(transition);
  },
 
  /**
   */
 
  enter: function() {
    Eif (!this._enter.length) return false;
    for (var i = 0, n = this._enter.length; i < n; i++) {
      this._enter[i].enter();
    }
  },
 
  /**
   */
 
  exit: function(complete) {
    Eif (!this._exit.length) return false;
    var self = this;
    process.nextTick(function() {
      async.each(self._exit, function(transition, next) {
        transition.exit(next);
      }, complete);
    });
 
    return true;
  }
});