mirror of
https://github.com/openseadragon/openseadragon.git
synced 2025-02-21 09:13:14 +03:00
Ready event signature fixed for consistency
Signature now handlerMethod(eventSource, eventData)
This commit is contained in:
parent
5ce3da2548
commit
5c37a1f375
@ -117,15 +117,8 @@ $.TileSource = function( width, height, tileSize, tileOverlap, minLevel, maxLeve
|
|||||||
for ( i = 0; i < arguments.length; i++ ) {
|
for ( i = 0; i < arguments.length; i++ ) {
|
||||||
if ( $.isFunction( arguments[ i ] ) ) {
|
if ( $.isFunction( arguments[ i ] ) ) {
|
||||||
callback = arguments[ i ];
|
callback = arguments[ i ];
|
||||||
// TODO Send generic object wrapping readySource as a property (breaking change)
|
this.addHandler( 'ready', function ( placeHolderSource, placeHolderEventData ) {
|
||||||
// TODO Maybe placeHolderSource should be passed to callback as well for consistency
|
callback( placeHolderSource, placeHolderEventData );
|
||||||
// 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
|
//only one callback per constructor
|
||||||
break;
|
break;
|
||||||
@ -308,10 +301,7 @@ $.TileSource.prototype = {
|
|||||||
options = $TileSource.prototype.configure.apply( _this, [ data, url ]);
|
options = $TileSource.prototype.configure.apply( _this, [ data, url ]);
|
||||||
readySource = new $TileSource( options );
|
readySource = new $TileSource( options );
|
||||||
_this.ready = true;
|
_this.ready = true;
|
||||||
// TODO Send generic object wrapping readySource as a property (breaking change)
|
_this.raiseEvent( 'ready', { tileSource: readySource } );
|
||||||
// Should be this:
|
|
||||||
//_this.raiseEvent( 'ready', { tileSource: readySource } );
|
|
||||||
_this.raiseEvent( 'ready', readySource );
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if( url.match(/\.js$/) ){
|
if( url.match(/\.js$/) ){
|
||||||
|
@ -438,8 +438,8 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
|
|||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
if ( $.type( tileSource ) == 'string') {
|
if ( $.type( tileSource ) == 'string') {
|
||||||
//If its still a string it means it must be a url at this point
|
//If its still a string it means it must be a url at this point
|
||||||
tileSource = new $.TileSource( tileSource, function( readySource ){
|
tileSource = new $.TileSource( tileSource, function( eventSource, eventData ){
|
||||||
openTileSource( _this, readySource );
|
openTileSource( _this, eventData.tileSource );
|
||||||
});
|
});
|
||||||
tileSource.addHandler( 'open-failed', function ( name, args ) {
|
tileSource.addHandler( 'open-failed', function ( name, args ) {
|
||||||
_this.raiseEvent( 'open-failed', args );
|
_this.raiseEvent( 'open-failed', args );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user