kbjr / events.js Goto Github PK
View Code? Open in Web Editor NEWA JavaScript micro-framework for events
Home Page: http://www.events-js.com
License: Other
A JavaScript micro-framework for events
Home Page: http://www.events-js.com
License: Other
Looking through HashChangeFix, it seems it defaults to poll every 25 ms. It only stops if it receives a native event for a hash change, which never comes if the hash never changes.
It seems to me that the default should be to check if the browser supports the native hashchange
event. Something like: ("onhashchange" in window.document.body)
For example, change:
supportsOnhashchange = (function() {
var nativeSupport = false;
return function(support) {
if (typeof support === 'boolean') {
nativeSupport = support;
}
return nativeSupport;
};
}()),
Into:
supportsOnhashchange = (function() {
var nativeSupport = "onhashchange" in window.document.body;
return function(support) {
if (typeof support === 'boolean') {
nativeSupport = support;
}
return nativeSupport;
};
}()),
i just test it on IE 6, and its not work,
could you making it to support IE 6, and other browser?
i like this framework,
hope you can make it compatible with other browser
thx
to be super-awesome, Events.js have to be fully unit test covered with test results in all browsers/operating systems
I tried the following code:
Events.bind(window, 'resize', function(e){
console.log('Hello World');
});
Events.invoke(window, 'resize');
But Chrome threw the following error:
Uncaught [object Object] on events.js:1015
Inspecting line 1015 of events.js
showed me that you called a function called despatchEvent
instead of dispatchEvent
. I think this is a typo? Anyway, fixing this (as well as the same typo on line 60), did prevent the script from throwing an error, but the event still wasn't invoked / executed.
Title kinda says it all, I would like to have it included in the NPM :)
Thanks
You code seem to replace mouseleave with mouseout, witch is bad. If you have child element in the element you binded the event to, mouseout will trigger for every child as well as the targeted element. Mouseleave fix that and trigger only one when you exit the element you binded the event on.
removing this code fix the issue for me :
mouseenter: {
attachesTo: 'mouseover',
eventTest: function(evt) {
return (! withinElement(evt, evt.originalTarget(), 'fromElement'));
}
},
mouseleave: {
attachesTo: 'mouseout',
eventTest: function(evt) {
return (! withinElement(evt, evt.originalTarget(), 'toElement'));
}
},
why is this there?
On Chrome and Safari (and possibly other browsers, but I haven't tried), with the following snippet of code, I run into a type error.
Code:
Events.ready( function() {
Events.unbind( window, "resize" );
Events.bind( window, "resize", function() { console.log( "I'm handling it." ); } );
} );
Error (Chrome):
Uncaught TypeError: Cannot read property 'removeNamespace' of undefined
self2.removeEvent events.js:929
self.unbind events.js:1203
If I call Events.unbind
after Events.bind
, this issue no longer occurs.
Also, if I change line 929:
// Remove the namespace
events[event].removeNamespace(segments);
to
// Remove the namespace
if (events[event] !== undefined) { events[event].removeNamespace(segments); }
The error goes away.
Great work on the library!
On the demo page, you can click on the "Try Me!" button a lot and it makes the animation calls stack. It should be pretty easy to fix this, I could even do it if the source was available.
Any chance the site source is available somewhere?
This is causing event binding to fail in IE. A fixed has been developed and tested and will be in the next push out.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.