twister-react/jsx/common/SetIntervalMixin.js

15 lines
401 B
JavaScript
Raw Normal View History

2015-04-29 11:19:10 +02:00
module.exports = SetIntervalMixin = {
componentWillMount: function() {
this.intervals = [];
},
setInterval: function() {
2015-04-30 11:42:10 +02:00
if (arguments[1]) {
this.intervals.push(setInterval.apply(null, arguments));
} else {
console.log("setInterval requested with malformed interval argument");
}
2015-04-29 11:19:10 +02:00
},
componentWillUnmount: function() {
this.intervals.map(clearInterval);
}
};