Remove window.Plugin and use import instead
				
					
				
			Also moved the shared api element to gr-js-api-interface-element, that's also where the componenet defined. Change-Id: Icf4f48be3e3ce843a4b0ec6491aaa5a27342b3d8
This commit is contained in:
		@@ -15,18 +15,19 @@
 | 
			
		||||
 * limitations under the License.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
import {sharedApiElement} from './gr-js-api-interface-element.js';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * GrChangeReplyInterface, provides a set of handy methods on reply dialog.
 | 
			
		||||
 */
 | 
			
		||||
export class GrChangeReplyInterface {
 | 
			
		||||
  constructor(plugin) {
 | 
			
		||||
    this.plugin = plugin;
 | 
			
		||||
    this._sharedApiEl = Plugin._sharedAPIElement;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  get _el() {
 | 
			
		||||
    return this._sharedApiEl.getElement(
 | 
			
		||||
        this._sharedApiEl.Element.REPLY_DIALOG);
 | 
			
		||||
    return sharedApiElement.getElement(
 | 
			
		||||
        sharedApiElement.Element.REPLY_DIALOG);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  getLabelValue(label) {
 | 
			
		||||
 
 | 
			
		||||
@@ -327,3 +327,6 @@ class GrJsApiInterface extends GestureEventListeners(
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
customElements.define(GrJsApiInterface.is, GrJsApiInterface);
 | 
			
		||||
 | 
			
		||||
// The shared api element used across components
 | 
			
		||||
export const sharedApiElement = document.createElement('gr-js-api-interface');
 | 
			
		||||
@@ -16,15 +16,13 @@ import {appContext} from '../../../services/app-context.js';
 | 
			
		||||
 * See the License for the specific language governing permissions and
 | 
			
		||||
 * limitations under the License.
 | 
			
		||||
 */
 | 
			
		||||
import './gr-api-utils.js';
 | 
			
		||||
import {importHref} from '../../../scripts/import-href.js';
 | 
			
		||||
 | 
			
		||||
import {
 | 
			
		||||
  PLUGIN_LOADING_TIMEOUT_MS,
 | 
			
		||||
  PRELOADED_PROTOCOL,
 | 
			
		||||
  getPluginNameFromUrl,
 | 
			
		||||
} from './gr-api-utils.js';
 | 
			
		||||
 | 
			
		||||
import {Plugin} from './gr-public-js-api.js';
 | 
			
		||||
import {getBaseUrl} from '../../../utils/url-util.js';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 
 | 
			
		||||
@@ -32,6 +32,7 @@ import {GrSettingsApi} from '../../plugins/gr-settings-api/gr-settings-api.js';
 | 
			
		||||
import {GrStylesApi} from '../../plugins/gr-styles-api/gr-styles-api.js';
 | 
			
		||||
import {GrPluginActionContext} from './gr-plugin-action-context.js';
 | 
			
		||||
import {pluginEndpoints} from './gr-plugin-endpoints.js';
 | 
			
		||||
import {sharedApiElement} from './gr-js-api-interface-element.js';
 | 
			
		||||
 | 
			
		||||
import {
 | 
			
		||||
  PRELOADED_PROTOCOL,
 | 
			
		||||
@@ -162,7 +163,7 @@ export class Plugin {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  on(eventName, callback) {
 | 
			
		||||
    Plugin._sharedAPIElement.addEventCallback(eventName, callback);
 | 
			
		||||
    sharedApiElement.addEventCallback(eventName, callback);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  url(opt_path) {
 | 
			
		||||
@@ -219,8 +220,8 @@ export class Plugin {
 | 
			
		||||
  changeActions() {
 | 
			
		||||
    return new GrChangeActionsInterface(
 | 
			
		||||
        this,
 | 
			
		||||
        Plugin._sharedAPIElement.getElement(
 | 
			
		||||
            Plugin._sharedAPIElement.Element.CHANGE_ACTIONS
 | 
			
		||||
        sharedApiElement.getElement(
 | 
			
		||||
            sharedApiElement.Element.CHANGE_ACTIONS
 | 
			
		||||
        )
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
@@ -313,8 +314,6 @@ export class Plugin {
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Plugin._sharedAPIElement = document.createElement('gr-js-api-interface');
 | 
			
		||||
 | 
			
		||||
// TODO: should be removed soon after all core plugins moved away from it.
 | 
			
		||||
const deprecatedAPI = {
 | 
			
		||||
  _loadedGwt: () => {},
 | 
			
		||||
@@ -431,7 +430,4 @@ const deprecatedAPI = {
 | 
			
		||||
      })
 | 
			
		||||
    );
 | 
			
		||||
  },
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
// TODO: Remove once no longer rely on global Plugin
 | 
			
		||||
window.Plugin = Plugin;
 | 
			
		||||
};
 | 
			
		||||
		Reference in New Issue
	
	Block a user