Git Product home page Git Product logo

Comments (4)

jridgewell avatar jridgewell commented on May 7, 2024

👍

from incremental-dom.

sparhami avatar sparhami commented on May 7, 2024

Maybe you could do something like:

my_thing.js

export {
  elementOpen as o,
  elementClose as c,
  ...
} from 'incremental-dom';
import { o as open, c as close } from 'my_thing';

and save even more bytes. If you use Incremental DOM in more than a few files (and you don't have mangling like Closure Compiler provides), you will probably out ahead compared to incremental DOM naming it open rather than elementOpen.

Depending on how you are bundling, the index.js of incremental DOM might just be optimized out entirely.

from incremental-dom.

jridgewell avatar jridgewell commented on May 7, 2024

I wouldn't worry about the file size here, but ease of use. I've written openElement more than a few times.

from incremental-dom.

sparhami avatar sparhami commented on May 7, 2024

Any name we choose would be problematic for someone. I have had problems with text being shadowed by a local variable named text. Open and close are likewise very generic and could collide with someone's open or close functions. ES6 is really nice in that it gives you the power to rename in the import statement itself to avoid these issues.

Ultimately the code is not intended to be written by hand so the naming is pretty arbitrary and you can rename it to suit your needs. Given that, I don't see a compelling reason to change what the library exports just to change it.

from incremental-dom.

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.