twister-react/jsx/common/SetIntervalMixin.js
2015-05-17 19:08:10 +02:00

15 lines
401 B
JavaScript
Executable File

module.exports = SetIntervalMixin = {
componentWillMount: function() {
this.intervals = [];
},
setInterval: function() {
if (arguments[1]) {
this.intervals.push(setInterval.apply(null, arguments));
} else {
console.log("setInterval requested with malformed interval argument");
}
},
componentWillUnmount: function() {
this.intervals.map(clearInterval);
}
};