Assigning the global Gerrit js object just once as window.Gerrit

The JS compiler for the Polymer 2 build has complained about
redeclaration of Gerrit, so apparently it understands that Gerrit and
window.Gerrit are the same thing.

Change-Id: Ic19549d63393954087d22ce72012661a7668cb83
This commit is contained in:
Ben Rohlfs
2019-06-05 12:22:19 +02:00
parent bf5b328748
commit 233b4f46ee
6 changed files with 7 additions and 22 deletions

View File

@@ -28,10 +28,7 @@ limitations under the License.
};
}
}
// Needed for JSCompiler to understand it's global.
// eslint-disable-next-line no-unused-vars, prefer-const
let Gerrit = window.Gerrit || {};
window.Gerrit = Gerrit;
window.Gerrit = window.Gerrit || {};
</script>
<link rel="import" href="/bower_components/polymer/polymer.html">

View File

@@ -477,7 +477,8 @@
flushPreinstalls();
const Gerrit = window.Gerrit || {};
window.Gerrit = window.Gerrit || {};
const Gerrit = window.Gerrit;
let _resolveAllPluginsLoaded = null;
let _allPluginsPromise = null;
@@ -689,8 +690,6 @@
}
};
window.Gerrit = Gerrit;
// Preloaded plugins should be installed after Gerrit.install() is set,
// since plugin preloader substitutes Gerrit.install() temporarily.
installPreloadedPlugins();

View File

@@ -72,9 +72,7 @@ limitations under the License.
return rev.commit.parents[parentIndex].commit;
};
if (!window.Gerrit) {
window.Gerrit = {};
}
window.Gerrit = window.Gerrit || {};
window.Gerrit.RevisionInfo = RevisionInfo;
})();
</script>

View File

@@ -15,10 +15,7 @@ See the License for the specific language governing permissions and
limitations under the License.
-->
<script>
// Needed for JSCompiler to understand it's global.
// eslint-disable-next-line no-unused-vars, prefer-const
let Gerrit = window.Gerrit || {};
window.Gerrit = Gerrit;
window.Gerrit = window.Gerrit || {};
</script>
<link rel="import" href="/bower_components/polymer/polymer.html">
<link rel="import" href="../elements/change/gr-change-view/gr-change-view.html">

View File

@@ -15,10 +15,7 @@ See the License for the specific language governing permissions and
limitations under the License.
-->
<script>
// Needed for JSCompiler to understand it's global.
// eslint-disable-next-line no-unused-vars, prefer-const
let Gerrit = window.Gerrit || {};
window.Gerrit = Gerrit;
window.Gerrit = window.Gerrit || {};
</script>
<link rel="import" href="../elements/diff/gr-diff/gr-diff.html">
<link rel="import" href="../elements/diff/gr-diff-cursor/gr-diff-cursor.html">

View File

@@ -1,7 +1,4 @@
<script>
// Needed for JSCompiler to understand it's global.
// eslint-disable-next-line no-unused-vars, prefer-const
let Gerrit = window.Gerrit || {};
window.Gerrit = Gerrit;
window.Gerrit = window.Gerrit || {};
</script>
<link rel="import" href="../elements/diff/gr-diff/gr-diff.html">