Get rid of global GrDiffBuilderSideBySide

* Replace the global GrDiffBuilderSideBySide variable with named
  imports.
* Update gr-app-global-var-init.js

Change-Id: I11d2480a2709d0037c255cf885b2375c2e7e1dbf
This commit is contained in:
Dmitrii Filippov
2020-03-23 20:50:29 +01:00
parent eca71692d2
commit ad32f07dcd
5 changed files with 88 additions and 92 deletions

View File

@@ -179,7 +179,6 @@ module.exports = {
"GrCountStringFormatter": "readonly",
"GrDiffBuilderBinary": "readonly",
"GrDiffBuilderImage": "readonly",
"GrDiffBuilderSideBySide": "readonly",
"GrDiffBuilderUnified": "readonly",
"GrDomHook": "readonly",
"GrDomHooksManager": "readonly",

View File

@@ -32,6 +32,7 @@ import {PolymerElement} from '@polymer/polymer/polymer-element.js';
import {htmlTemplate} from './gr-diff-builder-element_html.js';
import {GrAnnotation} from '../gr-diff-highlight/gr-annotation.js';
import {GrDiffBuilder} from './gr-diff-builder.js';
import {GrDiffBuilderSideBySide} from './gr-diff-builder-side-by-side.js';
const DiffViewMode = {
SIDE_BY_SIDE: 'SIDE_BY_SIDE',

View File

@@ -14,7 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
(function(window, GrDiffBuilderSideBySide) {
import {GrDiffBuilderSideBySide} from './gr-diff-builder-side-by-side.js';
(function(window) {
'use strict';
// Prevent redefinition.
@@ -180,4 +183,4 @@
};
window.GrDiffBuilderImage = GrDiffBuilderImage;
})(window, GrDiffBuilderSideBySide);
})(window);

View File

@@ -17,14 +17,8 @@
import {GrDiffBuilder} from './gr-diff-builder.js';
(function(window) {
'use strict';
// Prevent redefinition.
if (window.GrDiffBuilderSideBySide) { return; }
/** @constructor */
function GrDiffBuilderSideBySide(diff, prefs, outputEl, layers) {
export function GrDiffBuilderSideBySide(diff, prefs, outputEl, layers) {
GrDiffBuilder.call(this, diff, prefs, outputEl, layers);
}
GrDiffBuilderSideBySide.prototype = Object.create(GrDiffBuilder.prototype);
@@ -117,6 +111,3 @@ import {GrDiffBuilder} from './gr-diff-builder.js';
}
return null;
};
window.GrDiffBuilderSideBySide = GrDiffBuilderSideBySide;
})(window);

View File

@@ -28,6 +28,7 @@ import {GrAttributeHelper} from './plugins/gr-attribute-helper/gr-attribute-help
import {GrDiffLine} from './diff/gr-diff/gr-diff-line.js';
import {GrDiffGroup} from './diff/gr-diff/gr-diff-group.js';
import {GrDiffBuilder} from './diff/gr-diff-builder/gr-diff-builder.js';
import {GrDiffBuilderSideBySide} from './diff/gr-diff-builder/gr-diff-builder-side-by-side.js';
export function initGlobalVariables() {
window.GrDisplayNameUtils = GrDisplayNameUtils;
@@ -36,4 +37,5 @@ export function initGlobalVariables() {
window.GrDiffLine = GrDiffLine;
window.GrDiffGroup = GrDiffGroup;
window.GrDiffBuilder = GrDiffBuilder;
window.GrDiffBuilderSideBySide = GrDiffBuilderSideBySide;
}