From 12efe4946f342216c411f070a3aa1420073a3e20 Mon Sep 17 00:00:00 2001
From: Mike Greiling <mike@pixelcog.com>
Date: Fri, 30 Jun 2017 18:12:24 -0500
Subject: [PATCH] refactor UsagePing class to ES module syntax

---
 app/assets/javascripts/dispatcher.js | 3 ++-
 app/assets/javascripts/main.js       | 1 -
 app/assets/javascripts/usage_ping.js | 5 +----
 3 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/app/assets/javascripts/dispatcher.js b/app/assets/javascripts/dispatcher.js
index d73433beac1..8d805fc0c1a 100644
--- a/app/assets/javascripts/dispatcher.js
+++ b/app/assets/javascripts/dispatcher.js
@@ -52,6 +52,7 @@ import UsersSelect from './users_select';
 import RefSelectDropdown from './ref_select_dropdown';
 import GfmAutoComplete from './gfm_auto_complete';
 import ShortcutsBlob from './shortcuts_blob';
+import UsagePing from './usage_ping';
 import UsernameValidator from './username_validator';
 import VersionCheckImage from './version_check_image';
 import Wikis from './wikis';
@@ -433,7 +434,7 @@ import OAuthRememberMe from './oauth_remember_me';
           new Admin();
           switch (path[1]) {
             case 'cohorts':
-              new gl.UsagePing();
+              new UsagePing();
               break;
             case 'groups':
               new UsersSelect();
diff --git a/app/assets/javascripts/main.js b/app/assets/javascripts/main.js
index 35bdd167236..8a90aaf9336 100644
--- a/app/assets/javascripts/main.js
+++ b/app/assets/javascripts/main.js
@@ -154,7 +154,6 @@ import './syntax_highlight';
 import './task_list';
 import './todos';
 import './tree';
-import './usage_ping';
 import './user';
 
 // eslint-disable-next-line global-require, import/no-commonjs
diff --git a/app/assets/javascripts/usage_ping.js b/app/assets/javascripts/usage_ping.js
index fd3af7d7ab6..2389056bd02 100644
--- a/app/assets/javascripts/usage_ping.js
+++ b/app/assets/javascripts/usage_ping.js
@@ -1,4 +1,4 @@
-function UsagePing() {
+export default function UsagePing() {
   const usageDataUrl = $('.usage-data').data('endpoint');
 
   $.ajax({
@@ -10,6 +10,3 @@ function UsagePing() {
     },
   });
 }
-
-window.gl = window.gl || {};
-window.gl.UsagePing = UsagePing;
-- 
GitLab