Skip to content
This repository was archived by the owner on Jan 16, 2024. It is now read-only.

Fix fastboot errors #14

Merged
merged 1 commit into from
Jun 15, 2016
Merged

Conversation

chrissloey
Copy link
Contributor

@chrissloey chrissloey commented May 4, 2016

Fixed the errors that pop up when you try to run this addon in fastboot. This was the error:

navigator is not defined
ReferenceError: navigator is not defined

navigator is used in swiper.js, so to fix it I've guarded the import in index.js as recommended here.

Adding this guard caused an error with the instantiation of the Swiper in swiper-container. To fix that, I moved it from being in init to didInsertElement and removed the Ember.run.later - I think this will result in the code being executed at about the same time as before? didInsertElement isn't called by fastboot.

Although these changes mean that the addon can be used in fastboot without causing errors, there's some room for improvement. The HTML representation rendered by fastboot just spits out the full html (all slides) - a more accurate representation might be just the first slide but I'm not familiar enough with swiper.js to cover other potential use cases. I think fixing the errors is a decent first step anyway.

Wasn't sure how to write tests for this either although that seems more like a limitation of fastboot right now.

@Ledespana
Copy link
Contributor

Ledespana commented May 13, 2016

I'm having the same issue with fastboot
navigator is not defined ReferenceError: navigator is not defined
I agree that fixing the issue is a good first step

@Suven Suven merged commit ae6df91 into Ember-Swiper:master Jun 15, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants