GithubHelp home page GithubHelp logo

jQuery integration about eventi HOT 1 OPEN

esha avatar esha commented on September 24, 2024
jQuery integration

from eventi.

Comments (1)

nbubna avatar nbubna commented on September 24, 2024

Too many hooks and strategy differences to be worth replacing jQuery internals. There's a lot of special handling features. And instead of using DOM events, jQuery works hard to mimic their behavior (event props, bubbling paths, etc), then checks if the target has a method with the same name as the event type and calls it (unless the target is the window) to cause a native event/behavior. This makes sense in their context, but not for Eventi. Eventi is meant to use the DOM, not mimic it. And it is meant to fire/handle events, definitely not to cause DOM behaviors directly.

Further, their namespace system does the reverse of Eventi's listener filtering. $(el).on('type',...) does not handle type events fired with namespaces, giving trigger() more control than on(). This seems counter-intuitive to me, particularly because listener code tends to be more complex than triggering code. Thus, Eventi.on(el, 'type',...) handles all type events (regardless of category/tag/etc), to give on() more control than fire(). Adapting Eventi to support jQuery-style namespacing is not going to happen.

So, the state of things currently is this: jQuery can already listen for Eventi-fired DOM events (with all Eventi properties, but not Eventi listening/handling features), because we dispatch via DOM event system, instead of just mimicking it. Eventi can already hear jQuery-triggered native events (e.g. dispatched via elem.click() and without the few jQuery properties or features). The only complete misfire is that $(el).trigger('thisIsCustom') is inaccessible outside of jQuery handling.

The plan now is just to overwrite jQuery.trigger to simultaneously dispatch a CustomEvent on the element in the cases where there is no elem[type] function. This would at least allow DOM or Eventi listeners to capture all jQuery-triggered custom events, even including data arguments.

from eventi.

Related Issues (8)

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.