react-timer-mixin icon indicating copy to clipboard operation
react-timer-mixin copied to clipboard

Uncaught TypeError: Cannot read property 'apply' of undefined

Open liesislukas opened this issue 9 years ago • 3 comments

Console: image

File: image

No other errors, just this comes time to time, somewhere setter is used incorrectly.

liesislukas avatar Feb 11 '16 08:02 liesislukas

Can you inspect what is the value of callback? Could you have called set(Interval|Timeout|Immediate) with something other than a function?

tadeuzagallo avatar Feb 11 '16 09:02 tadeuzagallo

i guess callback is "undefined" - how error says. haven't yet found what's causing this error, because it's happening at random time, can't see pattern yet. Reviewed all code connected with setTimeout and setInterval, Immediate not used anywhere. It might be happening, that function was not there at time when "setInterval" was called, made some code re-order and it seems error is gone now.

I think there should be if-clause with check about callback

if(typeof callback !== 'function'){
    console.warn('#4dfs4df callback function is not a function:');
    console.warn(callback);
}

i like this way of console warning/logs/error because it gives some ID to find this error in code + gives current value of callback, that was passed to f-ction. Adding backtrace would be lovely too.

liesislukas avatar Feb 11 '16 13:02 liesislukas

I have the same problem. Any updates on this?

sscaff1 avatar May 12 '16 20:05 sscaff1