From b0b8a5281ed03f32e830c30a01277b1bb9a65888 Mon Sep 17 00:00:00 2001 From: vizo Date: Wed, 26 Sep 2012 05:16:39 +0300 Subject: [PATCH] Update lib/client.coffee --- lib/client.coffee | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/client.coffee b/lib/client.coffee index 73bb29c..bfadaed 100644 --- a/lib/client.coffee +++ b/lib/client.coffee @@ -1,4 +1,3 @@ - # Check for cache events on update and automatically refresh. Makes online-mode # work more like the traditional web. @@ -6,9 +5,9 @@ appCache = window.applicationCache exports.autoReload = true -window.addEventListener 'load', (e) -> - appCache.addEventListener 'updateready', (e) -> - if appCache.status == appCache.UPDATEREADY - appCache.swapCache() - window.location.reload() if exports.autoReload - +if appCache + window.addEventListener 'load', (e) -> + appCache.addEventListener 'updateready', (e) -> + if appCache.status == appCache.UPDATEREADY + appCache.swapCache() + window.location.reload() if exports.autoReload