Skip to content

Plain javascript api to asynchronously load javascript or css files - #13407

Merged
rullzer merged 3 commits into
masterfrom
js-async-loading
Jan 17, 2019
Merged

Plain javascript api to asynchronously load javascript or css files#13407
rullzer merged 3 commits into
masterfrom
js-async-loading

Conversation

@juliusknorr

@juliusknorrjuliusknorr commented Jan 7, 2019

Copy link
Copy Markdown
Member

This PR adds a javascript only public API to replace OC.addScript and OC.addStyle (which require jquery) to dynamically load js and css files after the initial loading.

Waiting for #13156 to integrate it into the webpack build.

Uses:

  • firstrunwizard: Load only when needed Move to vue firstrunwizard#106
  • richdocuments: Replace use of OC.addScript
  • files_texteditor: Replace use of OC.addScript

@juliusknorrjuliusknorr added the 2. developing Work in progress label Jan 7, 2019
@juliusknorrjuliusknorr added the technical debt 🧱 🤔🚀 label Jan 7, 2019
Comment threadcore/js/loader.js
@rullzer

Copy link
Copy Markdown
Member

Waiting for #13156 to integrate it into the webpack build.

go go go 🚀

Comment threadcore/js/loader.js Outdated
Comment threadcore/js/loader.js Outdated
@juliusknorr
juliusknorrforce-pushed the js-async-loading branch 2 times, most recently from 3298dba to 25e658cCompareJanuary 15, 2019 17:11
@juliusknorr

juliusknorr commented Jan 15, 2019

Copy link
Copy Markdown
MemberAuthor

@ChristophWurst@skjnldsv I have moved the loader to the webpack build in core/ and made it extend the existing window.OCP object. Should we have this as a separate entrypoint and chunk or keep it in the one bundle for now?

Besides that, it is ready for review.

@juliusknorrjuliusknorr added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Jan 15, 2019
Comment threadcore/js/js.js
Comment threadcore/src/OCP/loader.js Outdated
@ChristophWurst

Copy link
Copy Markdown
Member

@ChristophWurst@skjnldsv I have moved the loader to the webpack build in core/ and made it extend the existing window.OCP object. Should we have this as a separate entrypoint and chunk or keep it in the one bundle for now?

I think that is fine for now. We should be able to refactor that and move code around if necessary :)

@juliusknorr
juliusknorrforce-pushed the js-async-loading branch 3 times, most recently from 0dbe21f to b40dd20CompareJanuary 15, 2019 20:15
@rullzer

Copy link
Copy Markdown
Member

@ChristophWurst@skjnldsv I have moved the loader to the webpack build in core/ and made it extend the existing window.OCP object. Should we have this as a separate entrypoint and chunk or keep it in the one bundle for now?

I think that is fine for now. We should be able to refactor that and move code around if necessary :)

I agree. Basically the OCP stuff should always be loaded if possible anyway. So makes sense to have this in the dist pack.

Comment threadcore/src/OCP/loader.js
@juliusknorrjuliusknorr added this to the Nextcloud 16 milestone Jan 15, 2019
@rullzer

Copy link
Copy Markdown
Member

So this can go in?

@juliusknorr

Copy link
Copy Markdown
MemberAuthor

Yes, please review.

@rullzerrullzer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me and will make lazy loading much better :D

@ChristophWurstChristophWurst left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good!

@ChristophWurst

Copy link
Copy Markdown
Member

This will give a nice conflict with #13635 🤐

Comment threadcore/js/js.js
if (msie > 0 || trident > 0) {
cssVars();
cssVars({
watch: true

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

poor browser will die of exhaustion ⚰️

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pff so be it ;) No need to keep everybody stuck with crappy old stuff just ebcause of IE ;)

@MorrisJobke

Copy link
Copy Markdown
Member

Please rebase and rebuild to resolve the conflict.

rullzer
rullzer previously requested changes Jan 17, 2019
Comment threadcore/src/main.js
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to reviewWaiting for reviewstechnical debt🧱 🤔🚀

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@juliusknorr@rullzer@ChristophWurst@MorrisJobke@go2sh@kesselb@skjnldsv