Git Product home page Git Product logo

evt's People

Contributors

gitter-badger avatar marc-costello avatar

Watchers

 avatar  avatar

Forkers

gitter-badger

evt's Issues

Implement basic .raise() functionality

The ability to raise an event on an element.

For example:

evt('#my-element').on('my-event', function(e) {
    console.log(e.message);
});

evt('#my-element').raise('my-event', { message: "hello, world" });

should log "hello, world" to the console

Implement basic .on() functionality

For example:

evt('#my-element').on('click', function(e) {
    ...
});

That's it. Not worrying about filtering or event grouping. Just the basics

Event grouping

We need to be able to give name a group of handlers. So that we can turn on or off groups of handlers registered to an element.

For example:

evt('#my-element').on('click.group1', handler);
evt('#my-element').on('click.group2', handler);

evt('#my-element').off('group1');

group2 should still be attached.

It's worth keeping in mind when implementing this that we also plan on being able to call .off('.groupname') without specifying elements. So the element isn't the root here - the group is.

Implement basic .off() functionality

Remove all event handlers registered on the element.

evt('#my-element').off();

Note: Only remove handlers which have been registered using evt

DOM filtering

Having the ability to attach the events to an element higher up the tree, but be triggered by a child.

For example:

evt('table').on('click', 'td', function(e) {
    console.log('child td of table clicked');
});

Groups work on multiple elements

evt('#element1').on('click.multielementgroup' handler);
evt('#element2').on('click.multielementgroup' handler);

evt.suspend('.multielementgroup');

This should suspend all listeners to attached to all elements in the _multielementgroup' group.
So it really doesn't matter about which elements we are applying to. We can choose to interact with groups.

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.