4 ms·
If you want to roll your own UI (something less obtrusive, perhaps), this can be done in only a few lines of code. From our Backbone.js app... (function()
by philfreo 14y ago
If you want to roll your own UI (something less obtrusive, perhaps), this can be done in only a few lines of code. From our Backbone.js app...
(function() {
var errorView = null;
$(window).on('online', function() {
if (errorView) errorView.close();
errorView = null;
});
$(window).on('offline', function() {
errorView = new ErrorView({ message: 'No internet connection.'});
errorView.render();
});
}());