https://github.com/gregjopa/dynamic-script-loading-demo
Test out how the async and defer attributes work when doing dynamic script loading
https://github.com/gregjopa/dynamic-script-loading-demo
Last synced: 10 months ago
JSON representation
Test out how the async and defer attributes work when doing dynamic script loading
- Host: GitHub
- URL: https://github.com/gregjopa/dynamic-script-loading-demo
- Owner: gregjopa
- Created: 2020-08-14T16:28:32.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2020-08-14T16:29:17.000Z (almost 6 years ago)
- Last Synced: 2025-02-01T04:31:37.968Z (over 1 year ago)
- Language: JavaScript
- Size: 370 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Dynamic Script Loading Demo
The purpose of this repo is to test out how the `async` and `defer` attributes work when doing dynamic script loading.
## Getting Started
* Clone the repo
* Install dependencies with `npm install`
* Run server with `npm start` and go here:
[http://localhost:3000/](http://localhost:3000/)
## What to look for in the demos
There are two things to look for in the demos:
1. To measure script loading, check the Dev Tools network tab.

2. To measure script execution, check the Dev Tools console.

## Does defer work with dynamic script loading?
No, I don't believe so. I've tested these demos in Chrome and Firefox and defer/async don't seem to change behavior of the dynamically loaded scripts.
There may be a problem with these demos or something I'm not understanding. Feedback welcome.