Zulko / eagle.js

A hackable slideshow framework built with Vue.js
https://zulko.github.io/eaglejs-demo/
ISC License
4.08k stars 222 forks source link

how about load each slides vue component async ? #23

Closed c0b closed 6 years ago

c0b commented 6 years ago

wonder if you have researched to load each slides' vue file as async component?

https://vuejs.org/v2/guide/components.html#Async-Components

I can think the current one file list all slides will have a scalability issue when there's growing too many slides in the central registration, and build into one js file will be big! to the viewers, most probably view one or two slides only, it will be heavy for browser to load all available slides

https://github.com/Zulko/eaglejs-demo/blob/master/src/slideshows/slideshows.js

for example, how about make the front page https://zulko.github.io/eaglejs-demo/ just list all available slides with links, and then load the https://github.com/Zulko/eaglejs-demo/blob/master/src/slideshows/introducing-eagle/IntroducingEagle.vue only when user click https://zulko.github.io/eaglejs-demo/#/introducing-eagle ??

yaodingyd commented 6 years ago

Not sure this is a valid concern. For slides, only the current active one will be rendered, and compiling these inactive ones would take negligible overhead. For inserted slideshows, surly you can use async component, like example follows vue's official guide:

  components: {
    'awesome-inserted-slide': () => require('./AwesomeInsertedSlide'),
    'figures-slide': () => require('./FiguresSlide'),
    'end-credits': () => require('./components/EndCredits'),
    'themes-slideshow': () => require('../themes-slideshow/ThemesSlideshow')
  },
c0b commented 6 years ago

just think about the potential of this library can grow into a slides.com business, if started think about the multi-tenants, and the number of slides served grows big, will have to do loading async, right? together with #24 it may not necessarily be a core function of eagle.js but could be part of the eaglejs-boilerplate?

yaodingyd commented 6 years ago

For now async loading is totally in control of user land.