If I add this line to my code
if (window.applicationCache) {
applicationCache.addEventListener('updateready',
window.location.reload);
}
I get this weird error:
/home/matej/archiv/2014/projekty/zalmy/zalmy.ts(58,22): error TS2082:
Supplied parameters do not match any signature of call target:
Could not apply type '"downloading"' to argument 1 which is
of type 'string'.
/home/matej/archiv/2014/projekty/zalmy/zalmy.ts(58,22): error TS2087:
Could not select overload for 'call' expression.
make: *** [zalmy.js] Error 1
What's going on? Is it a bug in tsc? (using the latest typescript 0.9.5).
Wrap it up in a function :
if (window.applicationCache) {
applicationCache.addEventListener('updateready', () => {
window.location.reload();
});
}
Reason is that the argument for event listener (ev:Event)
is different from the optional argument for reload
(boolean)