mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-22 05:06:09 +03:00
Reverted breaking change for issue #201
To be grouped with other breaking changes for major version release. Also, minor formatting fix in src/eventhandler.js
This commit is contained in:
parent
57ae0656c1
commit
c7f184f199
@ -122,9 +122,9 @@ $.EventHandler.prototype = {
|
||||
Array.apply( null, events );
|
||||
return function ( source, args ) {
|
||||
var i,
|
||||
length = events.length;
|
||||
length = events.length;
|
||||
for ( i = 0; i < length; i++ ) {
|
||||
if (events[ i ]) {
|
||||
if ( events[ i ] ) {
|
||||
args.userData = events[ i ].userData;
|
||||
events[ i ].handler( source, args );
|
||||
}
|
||||
|
@ -117,8 +117,15 @@ $.TileSource = function( width, height, tileSize, tileOverlap, minLevel, maxLeve
|
||||
for ( i = 0; i < arguments.length; i++ ) {
|
||||
if ( $.isFunction( arguments[ i ] ) ) {
|
||||
callback = arguments[ i ];
|
||||
this.addHandler( 'ready', function ( placeHolderSource, placeHolderArgs ) {
|
||||
callback( placeHolderArgs.tileSource );
|
||||
// TODO Send generic object wrapping readySource as a property (breaking change)
|
||||
// TODO Maybe placeHolderSource should be passed to callback as well for consistency
|
||||
// with event handler signature?
|
||||
// Should be this (although technically it works as-is):
|
||||
//this.addHandler( 'ready', function ( placeHolderSource, placeHolderArgs ) {
|
||||
// callback( placeHolderArgs );
|
||||
//} );
|
||||
this.addHandler( 'ready', function ( placeHolderSource, readySource ) {
|
||||
callback( readySource );
|
||||
} );
|
||||
//only one callback per constructor
|
||||
break;
|
||||
@ -301,7 +308,10 @@ $.TileSource.prototype = {
|
||||
options = $TileSource.prototype.configure.apply( _this, [ data, url ]);
|
||||
readySource = new $TileSource( options );
|
||||
_this.ready = true;
|
||||
_this.raiseEvent( 'ready', { tileSource: readySource } );
|
||||
// TODO Send generic object wrapping readySource as a property (breaking change)
|
||||
// Should be this:
|
||||
//_this.raiseEvent( 'ready', { tileSource: readySource } );
|
||||
_this.raiseEvent( 'ready', readySource );
|
||||
};
|
||||
|
||||
if( url.match(/\.js$/) ){
|
||||
|
Loading…
Reference in New Issue
Block a user