Comments (11)
Glad you like it! Do you want to modify the PR?
In terms of the name, maybe we should keep before
for backwards compatibility.
from loadjs.
The append
hook looks useful but the name feels ambiguous. Did you consider any other names? beforeAppend
? insert
?
from loadjs.
@sourcec0de - do you have any thoughts on the naming convention? I'm leaning towards calling the attribute insert
instead of append
.
from loadjs.
@amorey I think that makes sense.
I can't think of a way to easily indicate that it's overriding the insertion. I kind of like beforeInsert
from loadjs.
Ok, thanks for the feedback. One problem with beforeInsert
is that it isn't clear that the method overrides the DOM insertion method.
from loadjs.
Sure, in that case i think append
makes sense.
from loadjs.
Once it's decided would you like me to update my PR?
from loadjs.
Sure, if you can update the PR that would be great. I thought you preferred insert
to append
...
from loadjs.
Here's another idea - how about combining the before
and append
callbacks into one method? If the before
callback returns false
then we can bypass the default insertion method at L143:
https://github.com/muicss/loadjs/blob/master/src/loadjs.js#L143
If we decide to do it this way then I think beforeInsert
would be an appropriate name.
from loadjs.
from loadjs.
@sourcec0de The latest version of LoadJS (v3.5.0) has support for this functionality. Just return false
in the before
callback to bypass the default DOM insertion mechanism:
https://github.com/muicss/loadjs
https://www.npmjs.com/package/loadjs
Let me know if you run into any issues using the new feature.
from loadjs.
Related Issues (20)
- How to Solve the Problem of Repeated Loading of Scripts HOT 3
- Is it possible to load JSON? HOT 2
- Stylesheets not loading in ie11 HOT 4
- Using loadjs in a Vanilla project: require is not defined error HOT 2
- CSS order HOT 2
- Security policy questions HOT 3
- Old browsers (Opera12) can't use document.head HOT 3
- Success/Error callbacks never called when the script element has the "nomodule" attribute. HOT 15
- More details than "path not found" HOT 2
- Announcement: New version with support for Promises and an Edge CSS onerror bugfix HOT 1
- Update comments in src to clarify arguments to loadJs HOT 1
- Custom script attributes HOT 3
- Ability to insert elements after or before certain element HOT 2
- Image loading and error handling HOT 2
- Support "defer" as well as "async"? HOT 6
- query args cause issues with native file type detection HOT 5
- Idempotent request option HOT 5
- Can not detect image if url has ?=rand123456 HOT 1
- Announcement: New version with support for image/css urls with query arguments and anchor tags
- Action required: Greenkeeper could not be activated 🚨
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 loadjs.