Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add append hook #41

Open
sourcec0de opened this issue Mar 18, 2017 · 11 comments
Open

add append hook #41

sourcec0de opened this issue Mar 18, 2017 · 11 comments

Comments

@sourcec0de
Copy link

see my PR for details #40

@amorey
Copy link
Member

amorey commented Mar 18, 2017

The append hook looks useful but the name feels ambiguous. Did you consider any other names? beforeAppend? insert?

@amorey
Copy link
Member

amorey commented Mar 21, 2017

@sourcec0de - do you have any thoughts on the naming convention? I'm leaning towards calling the attribute insert instead of append.

@sourcec0de
Copy link
Author

sourcec0de commented Mar 21, 2017

@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

@amorey
Copy link
Member

amorey commented Mar 21, 2017

Ok, thanks for the feedback. One problem with beforeInsert is that it isn't clear that the method overrides the DOM insertion method.

@sourcec0de
Copy link
Author

Sure, in that case i think append makes sense.

@sourcec0de
Copy link
Author

Once it's decided would you like me to update my PR?

@amorey
Copy link
Member

amorey commented Mar 21, 2017

Sure, if you can update the PR that would be great. I thought you preferred insert to append...

@amorey
Copy link
Member

amorey commented Mar 21, 2017

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.

@sourcec0de
Copy link
Author

sourcec0de commented Mar 21, 2017 via email

@amorey
Copy link
Member

amorey commented Mar 21, 2017

Glad you like it! Do you want to modify the PR?

In terms of the name, maybe we should keep before for backwards compatibility.

@amorey
Copy link
Member

amorey commented Mar 28, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants