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);