mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-25 14:46:10 +03:00
doh! had changed file name and class name of eventhandlerlist to just eventhandler and guess to forgot to add it back to git. plus other commits including version build id increment
This commit is contained in:
parent
acfd3d0280
commit
381763c19e
@ -6,7 +6,7 @@
|
||||
PROJECT: openseadragon
|
||||
BUILD_MAJOR: 0
|
||||
BUILD_MINOR: 8
|
||||
BUILD_ID: 12
|
||||
BUILD_ID: 13
|
||||
BUILD: ${PROJECT}.${BUILD_MAJOR}.${BUILD_MINOR}.${BUILD_ID}
|
||||
VERSION: ${BUILD_MAJOR}.${BUILD_MINOR}.${BUILD_ID}
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
* (c) 2010 OpenSeadragon
|
||||
* (c) 2010 CodePlex Foundation
|
||||
*
|
||||
* OpenSeadragon 0.8.12
|
||||
* OpenSeadragon 0.8.13
|
||||
* ----------------------------------------------------------------------------
|
||||
*
|
||||
* License: New BSD License (BSD)
|
||||
|
54
src/eventhandler.js
Normal file
54
src/eventhandler.js
Normal file
@ -0,0 +1,54 @@
|
||||
|
||||
(function($){
|
||||
|
||||
|
||||
$.EventHandler = function() {
|
||||
this.events = {};
|
||||
};
|
||||
|
||||
$.EventHandler.prototype = {
|
||||
|
||||
addHandler: function(id, handler) {
|
||||
var events = this.events[ id ];
|
||||
if( !events ){
|
||||
this.events[ id ] = events = [];
|
||||
}
|
||||
events[events.length] = handler;
|
||||
},
|
||||
|
||||
removeHandler: function(id, handler) {
|
||||
//Start Thatcher - unneccessary indirection. Also, because events were
|
||||
// - not actually being removed, we need to add the code
|
||||
// - to do the removal ourselves. TODO
|
||||
var evt = this.events[ id ];
|
||||
if (!evt) return;
|
||||
//End Thatcher
|
||||
},
|
||||
|
||||
getHandler: function(id) {
|
||||
var evt = this.events[ id ];
|
||||
if (!evt || !evt.length) return null;
|
||||
evt = evt.length === 1 ?
|
||||
[evt[0]] :
|
||||
Array.apply( null, evt );
|
||||
return function(source, args) {
|
||||
for (var i = 0, l = evt.length; i < l; i++) {
|
||||
evt[i](source, args);
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
raiseEvent: function(eventName, eventArgs) {
|
||||
var handler = this.getHandler( eventName );
|
||||
|
||||
if (handler) {
|
||||
if (!eventArgs) {
|
||||
eventArgs = new Object();
|
||||
}
|
||||
|
||||
handler(this, eventArgs);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}( OpenSeadragon ));
|
Loading…
Reference in New Issue
Block a user