MCPcopy Index your code
hub / github.com/ionic-team/ionic-framework / connectedCallback

Method connectedCallback

core/src/components/menu/menu.tsx:201–254  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

199 @Event() protected ionMenuChange!: EventEmitter<MenuChangeEventDetail>;
200
201 async connectedCallback() {
202 // TODO: connectedCallback is fired in CE build
203 // before WC is defined. This needs to be fixed in Stencil.
204 if (typeof customElements !== 'undefined' && customElements != null) {
205 await customElements.whenDefined('ion-menu');
206 }
207
208 if (this.type === undefined) {
209 this.type = config.get('menuType', 'overlay');
210 }
211
212 if (!Build.isBrowser) {
213 return;
214 }
215
216 const content = this.contentId !== undefined ? document.getElementById(this.contentId) : null;
217
218 if (content === null) {
219 printIonError('[ion-menu] - Must have a "content" element to listen for drag events on.');
220 return;
221 }
222
223 if (this.el.contains(content)) {
224 printIonError(
225 `[ion-menu] - The "contentId" should refer to the main view's ion-content, not the ion-content inside of the ion-menu.`
226 );
227 }
228
229 this.contentEl = content as HTMLElement;
230
231 // add menu's content classes
232 content.classList.add('menu-content');
233
234 this.typeChanged(this.type!, undefined);
235 this.sideChanged();
236
237 // register this menu with the app's menu controller
238 menuController._register(this);
239
240 this.menuChanged();
241 this.gesture = (await import('../../utils/gesture')).createGesture({
242 el: document,
243 gestureName: 'menu-swipe',
244 gesturePriority: 30,
245 threshold: 10,
246 blurOnStart: true,
247 canStart: (ev) => this.canStart(ev),
248 onWillStart: () => this.onWillStart(),
249 onStart: () => this.onStart(),
250 onMove: (ev) => this.onMove(ev),
251 onEnd: (ev) => this.onEnd(ev),
252 });
253 this.updateState();
254 }
255
256 componentWillLoad() {
257 this.inheritedAttributes = inheritAriaAttributes(this.el);

Callers

nothing calls this directly

Calls 14

typeChangedMethod · 0.95
sideChangedMethod · 0.95
menuChangedMethod · 0.95
canStartMethod · 0.95
onWillStartMethod · 0.95
onStartMethod · 0.95
onMoveMethod · 0.95
onEndMethod · 0.95
updateStateMethod · 0.95
printIonErrorFunction · 0.90
createGestureMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected