modulor-js/modulor

this.off is not a function. (In 'this.off()', 'this.off' is undefined)

pankajpatel opened this issue · 3 comments

this.off();

On Safari and Safari UIWebView, this throws an error in case of continuous attach and detach.

when disconnectedCallback happens; if the modulor has not completely initialized, this .off stays undefined and throws error. My suggestion would be to make it this.off && this.off()

Good idea. Could you please make a pr on this? I don't have an environment where i could reproduce it

Sure. I would also like to propose this same approach to following error on this.trigger

this.trigger is not a function. (In 'this.trigger("component-attached")', 'this.trigger' is undefined)

primary device throwing this error is Mobile Safari

#25 should fix this