Giter Club home page Giter Club logo

Comments (11)

amorey avatar amorey commented on August 15, 2024 1

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.

amorey avatar amorey commented on August 15, 2024

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

from loadjs.

amorey avatar amorey commented on August 15, 2024

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

from loadjs.

sourcec0de avatar sourcec0de commented on August 15, 2024

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

amorey avatar amorey commented on August 15, 2024

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.

sourcec0de avatar sourcec0de commented on August 15, 2024

Sure, in that case i think append makes sense.

from loadjs.

sourcec0de avatar sourcec0de commented on August 15, 2024

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

from loadjs.

amorey avatar amorey commented on August 15, 2024

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

from loadjs.

amorey avatar amorey commented on August 15, 2024

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.

sourcec0de avatar sourcec0de commented on August 15, 2024

from loadjs.

amorey avatar amorey commented on August 15, 2024

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.