https://github.com/webcaetano/jinx-events
Jinx module for prototype events
https://github.com/webcaetano/jinx-events
Last synced: 6 months ago
JSON representation
Jinx module for prototype events
- Host: GitHub
- URL: https://github.com/webcaetano/jinx-events
- Owner: webcaetano
- License: mit
- Created: 2015-05-05T11:52:01.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2015-05-06T04:43:33.000Z (about 11 years ago)
- Last Synced: 2024-12-29T10:28:53.398Z (over 1 year ago)
- Language: JavaScript
- Size: 137 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# [](https://github.com/webcaetano/jinx)
[Jinx](https://github.com/webcaetano/jinx) module for chaining prototype events
## Installation
```
npm install jinx-events
```
Example
```javascript
require('jinx-events');
var myMc = new foo();
myMc.x = 250;
myMc.y = 100;
addChild(myMc);
myMc.$bind('enterFrame',function(){
this.rotation+=0.5; // it will spin
}).$bind('click',function(){
this.y+=5; // it will go down a when clicked
}).$hover(function(){
this.alpha=0.5; // it will be 50% alpha when mouse hover
},function(){
this.alpha=1; // it will be 0% alpha when mouse out
})
```
## Events suported.
- enterFrame
- removed
- load
- mouseMove
- mouseUp
- mouseDown
- mouseOver
- mouseOut
- releaseOutside
- click
- mouseWhell
- rollOut
- rollOver
- rightClick
## Alias
- $click = $bind('click');
- $hover([function mouseOver],[function mouseOut]) = $bind('mouseOver')
- $mouseOver([function mouseOver],[function mouseOut]) = $bind('mouseOver')
- $mouseMove = $bind('mouseMove');
- $mouseOut = $bind('mouseOut');
- $mouseUp = $bind('mouseUp');
- $enterFrame = $bind('enterFrame');
- $mouseDown([function mouseDown],[function release || releaseOutside]) = $bind('mouseDown')
---------------------------------
The MIT [License](https://raw.githubusercontent.com/webcaetano/jinx/master/LICENSE.md)