Update API for embed support
This commit is contained in:
parent
08d10e9c88
commit
8918cdd058
21
api.js
21
api.js
@ -16,6 +16,7 @@ var BotanJS = function()
|
||||
events.EventEmitter.call( this );
|
||||
this.sv = {};
|
||||
this.kv = {};
|
||||
this.embed = {};
|
||||
};
|
||||
|
||||
util.inherits( BotanJS, events.EventEmitter );
|
||||
@ -43,6 +44,19 @@ BotanJS.prototype.remove = function( mod )
|
||||
delete this.kv[ mod ];
|
||||
};
|
||||
|
||||
BotanJS.prototype.storeForRender = function( rainet, type, ch )
|
||||
{
|
||||
var _self = this;
|
||||
if( ch.endsWith( "." + type ) )
|
||||
{
|
||||
_self[ type ] = rainet + ch;
|
||||
}
|
||||
else
|
||||
{
|
||||
_self.embed[ type ] = ch;
|
||||
}
|
||||
};
|
||||
|
||||
BotanJS.prototype.compile = function( type )
|
||||
{
|
||||
var _self = this;
|
||||
@ -89,8 +103,9 @@ BotanJS.prototype.compile = function( type )
|
||||
|
||||
res.on( "data", ( x ) => ch += x );
|
||||
|
||||
res.on( "end", function() {
|
||||
_self[ type ] = rainet + ch;
|
||||
res.on( "end", function()
|
||||
{
|
||||
_self.storeForRender( rainet, type, ch );
|
||||
|
||||
Dragonfly.Debug( "Storing " + ch + " to fastcache[ " + fastCache.id + " ]" );
|
||||
|
||||
@ -118,7 +133,7 @@ BotanJS.prototype.compile = function( type )
|
||||
Dragonfly.Debug( "FastCache: " + k );
|
||||
fCache.expire( 30 );
|
||||
|
||||
_self[ type ] = rainet + k;
|
||||
_self.storeForRender( rainet, type, k );
|
||||
_self.emit( "complete" );
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user