Comments (4)
Ive created this PR #18
from vue-plugin-load-script.
I don't believe a race condition exists there. That line exists to prevent duplicate <script>
elements for the same source.
Loading does not begin until the <script>
element is injected into the DOM. The attribute async
has no effect on this behavior.
With that said, I do see a potential for improvement in the error/abort event handlers by removing the <script>
element before rejecting the Promise, so failures don't prevent future successes.
from vue-plugin-load-script.
Here's an example:
https://codesandbox.io/s/vue-template-mjdoz?fontsize=14
If loadScript
is called multiple times with the same url, the subsequent calls will find the DOM element and immediately resolve (even though the script may not have actually loaded yet).
from vue-plugin-load-script.
Thank you for the example, I hadn't anticipated that usage.
I have a solution in mind that involves tracking script resolvers manually, since HTMLScriptElement
is fairly dumb in regards to its current status. It'll take me a few days to get around to it though.
from vue-plugin-load-script.
Related Issues (20)
- npm and yarn install HOT 2
- Load multiple scripts simultaneously HOT 3
- No Ts support HOT 6
- Getting error: Uncaught ReferenceError: undefinedLoadScript is not defined
- Request for clarification of instructions HOT 4
- [Object Object] HOT 1
- What about CompositionAPI import? HOT 3
- [Feature Request] Add style support
- Can't import when using Nuxt HOT 2
- Installation error with Vue 3 - Cannot set property "$loadScript" of undefined HOT 5
- VUE SSR Issue HOT 3
- Adding defer and async options HOT 1
- Type definition in v1.3.4 overrides local Vue type definitions HOT 3
- Object(...) is not a function HOT 3
- Typescript 4.5.4 errors with Vue.install HOT 2
- 2022 - Plugin no longer works at all, this should be archived HOT 1
- how to load a vue compiled app into current app HOT 2
- v1.3.2 typescript definition not compatible with Vue 2.6
- error when running ssr + mix
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vue-plugin-load-script.