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

@juliusknorr juliusknorr 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

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

rullzer commented Jan 10, 2019

Copy link
Copy Markdown
Member

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

go go go 🚀

Comment thread core/js/loader.js Outdated
Comment thread core/js/loader.js Outdated
@juliusknorr juliusknorr force-pushed the js-async-loading branch 2 times, most recently from 3298dba to 25e658c Compare January 15, 2019 17:11
@juliusknorr

juliusknorr commented Jan 15, 2019

Copy link
Copy Markdown
Member Author

@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.

@juliusknorr juliusknorr added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Jan 15, 2019
Comment thread core/js/js.js
Comment thread core/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 juliusknorr force-pushed the js-async-loading branch 3 times, most recently from 0dbe21f to b40dd20 Compare January 15, 2019 20:15
@rullzer

rullzer commented Jan 15, 2019

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 thread core/src/OCP/loader.js
@juliusknorr juliusknorr added this to the Nextcloud 16 milestone Jan 15, 2019
@rullzer

rullzer commented Jan 16, 2019

Copy link
Copy Markdown
Member

So this can go in?

@juliusknorr

Copy link
Copy Markdown
Member Author

Yes, please review.

@rullzer rullzer 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

@ChristophWurst ChristophWurst 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 thread core/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.

Comment thread core/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 free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews technical debt 🧱 🤔🚀

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants