AstroJS/botanjs/src/Astro/Bootstrap.js

70 lines
1.5 KiB
JavaScript
Raw Normal View History

2015-08-14 13:06:23 +00:00
(function(){
var ns = __namespace( "Astro.Bootstrap" );
var debug = __import( "System.Debug" );
// __import( "Dandelion.CSSReset" ); CSS_RESERVATION
// __import( "Dandelion.CSSAnimations" ); CSS_RESERVATION
var infs = [];
// Init Helper, body onload
var regInitFunc = function( f ) { infs[ infs.length ] = f; };
var inited = false;
var consoleExists = false;
var CConsole = "Components.Console";
var SyntaxHighlighter = "Libraries.SyntaxHighlighter";
var init = function()
{
if( inited ) return;
inited = true;
if( consoleExists )
{
// The + is to prevent resolver resolving this class
// since this is optional
new ( __import( CConsole ) );
}
var l = infs.length;
debug.Info( "[Astro.Blog] init(" + l + ")" );
for( var i = 0; i < l; i ++ )
{
infs[i]();
}
2017-11-08 03:05:50 +00:00
document.dispatchEvent( new Event( "Astro.Start" ) );
2015-08-14 13:06:23 +00:00
};
/*{{{ Class Catching */
BotanJS.addEventListener( "NS_EXPORT", function( e )
{
switch( e.data.name )
{
case CConsole:
consoleExists = true;
break;
case SyntaxHighlighter:
debug.Info( "[SyntaxHighlighter] Initializing" );
/** @type {Libraries.SyntaxHighlighter} */
var synt = __import( SyntaxHighlighter );
synt.defaults["toolbar"] = false;
synt.defaults["quick-code"] = false;
synt.highlight();
2015-08-14 13:06:23 +00:00
break;
}
});
try {
__import( CConsole );
consoleExists = true;
} catch( e ) { };
/* End Console Catching }}}*/
ns[ NS_EXPORT ]( EX_FUNC, "init", init );
ns[ NS_EXPORT ]( EX_FUNC, "regInit", regInitFunc )
})();