From 3aeca7069ef6efd743e30abbab928f75d701c250 Mon Sep 17 00:00:00 2001 From: Simon Eisenmann Date: Wed, 21 May 2014 14:40:59 +0200 Subject: [PATCH] Make sure that settings are saved on reload. --- static/js/directives/settings.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/static/js/directives/settings.js b/static/js/directives/settings.js index 3b51c132..0017391c 100644 --- a/static/js/directives/settings.js +++ b/static/js/directives/settings.js @@ -18,7 +18,7 @@ * along with this program. If not, see . * */ -define(['underscore', 'text!partials/settings.html'], function(_, template) { +define(['jquery', 'underscore', 'text!partials/settings.html'], function($, _, template) { return ["$compile", "mediaStream", function($compile, mediaStream) { @@ -50,6 +50,13 @@ define(['underscore', 'text!partials/settings.html'], function(_, template) { var localStream = null; + // Make sure to save settings when they are open and the page is reloaded. + $(window).on("unload", function() { + if ($scope.layout.settings) { + $scope.saveSettings(); + } + }); + $scope.saveSettings = function() { var user = $scope.user; $scope.update(user);