https://github.com/plotdb/scriptloader
https://github.com/plotdb/scriptloader
Last synced: 27 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/plotdb/scriptloader
- Owner: plotdb
- Created: 2020-12-30T07:55:02.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-12-30T08:48:41.000Z (over 5 years ago)
- Last Synced: 2025-02-26T08:35:17.930Z (over 1 year ago)
- Language: JavaScript
- Size: 2.73 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# scriptloader
preload script while execute in order, when DOMContentLoaded is called.
The test under `web` folder ( 20 requests, 533kB resources ) contains test with `scriptloader` and `synchronous` tags. Their results:
- `tag`: `DOMContentLoaded` ~ `Load`. ( 670ms )
- `tag` with `defer`: similar to `tag`.
- `scriptloader`: `DOMContentLoaded` (588ms) faster than `Load` by ~ 80ms (666ms)
where
- `DOMContentLoaded`: DOM is ready, so the handler can lookup DOM nodes.
- `Load`: external resources are loaded, so styles are applied, image sizes are known etc.
## Discuss
- `scriptloader` is faster in `DOMConentLoaded`, because it defers script executing after `DOMContentLoaded`.
- `scriptloader` may be used to control cache of js files.