Should also aware of the loaded classes

This commit is contained in:
斟酌 鵬兄 2016-05-09 15:51:00 +08:00
parent 4083e2c46f
commit 6c9011f92c
1 changed files with 14 additions and 4 deletions

View File

@ -9,6 +9,8 @@
/** @type {Dandelion} */ /** @type {Dandelion} */
var Dand = __import( "Dandelion" ); var Dand = __import( "Dandelion" );
var LoadedClasses = {};
var loadFile = function ( sapi, request, mode ) var loadFile = function ( sapi, request, mode )
{ {
var head = Dand.tag( "head" )[0]; var head = Dand.tag( "head" )[0];
@ -59,13 +61,13 @@
for( var i in classes ) for( var i in classes )
{ {
var c = classes[i]; var c = classes[i];
if( excludes.indexOf( c ) == -1 ) if( ~excludes.indexOf( c ) || LoadedClasses[ c ] )
{ {
needed.push( c ); handler( c );
} }
else else
{ {
handler( c ); needed.push( c );
} }
} }
@ -84,7 +86,15 @@
); );
BotanJS.addEventListener( "NS_INIT", onLoad ); BotanJS.addEventListener( "NS_INIT", onLoad );
BotanJS.addEventListener( "NS_EXPORT", onLoad );
BotanJS.addEventListener( "NS_EXPORT", function( e )
{
if( e.data.name )
{
LoadedClasses[ e.data.name ] = 1;
}
onLoad( e );
} );
}; };
}; };