DEV: Why use a whole object when a functionw will do?

DEV: Why use a whole object when a functionw will do?

diff --git a/app/assets/javascripts/discourse/app/controllers/preferences/interface.js b/app/assets/javascripts/discourse/app/controllers/preferences/interface.js
index 2fcc578..c9fb194 100644
--- a/app/assets/javascripts/discourse/app/controllers/preferences/interface.js
+++ b/app/assets/javascripts/discourse/app/controllers/preferences/interface.js
@@ -5,7 +5,7 @@ import { setDefaultHomepage } from "discourse/lib/utilities";
 import discourseComputed from "discourse-common/utils/decorators";
 import { listThemes, setLocalTheme } from "discourse/lib/theme-selector";
 import { popupAjaxError } from "discourse/lib/ajax-error";
-import pageReloader from "discourse/helpers/page-reloader";
+import { reload } from "discourse/helpers/page-reloader";
 import {
   safariHacksDisabled,
   isiPad,
@@ -193,7 +193,7 @@ export default Controller.extend({
           }
 
           if (this.themeId !== this.currentThemeId) {
-            pageReloader.reload();
+            reload();
           }
         })
         .catch(popupAjaxError);
diff --git a/app/assets/javascripts/discourse/app/helpers/page-reloader.js b/app/assets/javascripts/discourse/app/helpers/page-reloader.js
index 6429be3..a227bec 100644
--- a/app/assets/javascripts/discourse/app/helpers/page-reloader.js
+++ b/app/assets/javascripts/discourse/app/helpers/page-reloader.js
@@ -1,10 +1,7 @@
-import EmberObject from "@ember/object";
 import Ember from "ember";
 
-export default EmberObject.create({
-  reload: function() {
-    if (!Ember.testing) {
-      location.reload();
-    }
+export function reload() {
+  if (!Ember.testing) {
+    location.reload();
   }
-});
+}

GitHub sha: e5cd331f

1 Like