Allow modules to be prepended

This commit is contained in:
斟酌 鵬兄 2016-06-08 18:44:42 +08:00
parent 3bfe995478
commit 47c7513937

17
api.js
View File

@ -14,11 +14,22 @@ var hash = cl.load( "botansx.utils.hash" );
var BotanJS = function()
{
events.EventEmitter.call( this );
this.sv = {};
this.kv = {};
};
util.inherits( BotanJS, events.EventEmitter );
BotanJS.prototype.unshift = function()
{
for( var i in arguments )
{
var mod = arguments[i];
this.sv[ mod ] = true;
this.remove( mod );
}
};
BotanJS.prototype.push = function()
{
for( var i in arguments )
@ -37,10 +48,8 @@ BotanJS.prototype.compile = function( type )
var _self = this;
var j = conf.debug ? [ "Components.Console" ] : [];
for( var i in this.kv )
{
if( this.kv[ i ] ) j.push( i );
}
for( var i in this.sv ) if( this.sv[ i ] ) j.push( i );
for( var i in this.kv ) if( this.kv[ i ] ) j.push( i );
var rainet = conf.rinet || conf.serviceUri;