mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-17 18:54:11 +08:00
fix(slides): check that mutation observer is defined for ssr (#20791)
This commit is contained in:
@ -132,6 +132,8 @@ export class Slides implements ComponentInterface {
|
|||||||
@Event() ionSlideTouchEnd!: EventEmitter<void>;
|
@Event() ionSlideTouchEnd!: EventEmitter<void>;
|
||||||
|
|
||||||
connectedCallback() {
|
connectedCallback() {
|
||||||
|
// tslint:disable-next-line: strict-type-predicates
|
||||||
|
if (typeof MutationObserver !== 'undefined') {
|
||||||
const mut = this.mutationO = new MutationObserver(() => {
|
const mut = this.mutationO = new MutationObserver(() => {
|
||||||
if (this.swiperReady) {
|
if (this.swiperReady) {
|
||||||
this.update();
|
this.update();
|
||||||
@ -143,6 +145,7 @@ export class Slides implements ComponentInterface {
|
|||||||
});
|
});
|
||||||
this.el.componentOnReady().then(() => this.initSwiper());
|
this.el.componentOnReady().then(() => this.initSwiper());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async disconnectedCallback() {
|
async disconnectedCallback() {
|
||||||
if (this.mutationO) {
|
if (this.mutationO) {
|
||||||
|
Reference in New Issue
Block a user