From 70bccf0eca4ebdb291074667b816ddcc709f039e 2014-12-10 20:29:28 From: Jonathan Frederic Date: 2014-12-10 20:29:28 Subject: [PATCH] Make widgets persist across page refresh --- diff --git a/IPython/html/static/widgets/js/manager.js b/IPython/html/static/widgets/js/manager.js index 3fae1f8..8ea6245 100644 --- a/IPython/html/static/widgets/js/manager.js +++ b/IPython/html/static/widgets/js/manager.js @@ -102,6 +102,13 @@ define([ }); }; + // Use local storage to persist widgets across page refresh by default. + WidgetManager.set_state_callbacks(function() { + return JSON.parse(localStorage.widgets || '{}'); + }, function(state) { + localStorage.widgets = JSON.stringify(state); + }); + //-------------------------------------------------------------------- // Instance level //--------------------------------------------------------------------