Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/deepraining/see-view

一个 JQuery 事件绑定的快捷方式,类似 Backbone.View. A shortcut way of event binding for JQuery, like Backbone.View.
https://github.com/deepraining/see-view

bind event jquery view

Last synced: about 5 hours ago
JSON representation

一个 JQuery 事件绑定的快捷方式,类似 Backbone.View. A shortcut way of event binding for JQuery, like Backbone.View.

Awesome Lists containing this project

README

        

# see-view

[中文文档](./README.md)

A shortcut way of event binding for JQuery, like Backbone.View.

```
npm install see-view --save
```

```
import seeView from 'see-view';

seeView({
events: {
'eventName selectors': 'methodName', // default use event delegating
'!eventName selectors': 'methodName', // do not use event delegating.
},
methodName(e) {
// do something
},
});
```

- `eventName`: event name, `click, focus, ...`
- `selectors`: use `,` to split multiple selectors, `#id`, `#id, .class, tagName`, `#id tagName, .class tagName`
- use spaces to split eventName and selectors
- if you do not want to use event delegating, add `!` before `eventName`