Added PostFrame, extract eventargs

This commit is contained in:
2016-06-16 15:16:29 +08:00
parent dcdd941f3b
commit cd2cce7e98
5 changed files with 162 additions and 31 deletions

11
net/events/EventArgs.js Normal file
View File

@@ -0,0 +1,11 @@
"use strict";
class EventArgs
{
constructor()
{
this.Handled = false;
}
}
module.exports = EventArgs;

View File

@@ -0,0 +1,36 @@
"use strict";
var EventArgs = require( "./EventArgs" );
class HttpRequestComplete extends EventArgs
{
constructor( Response, ResponseData )
{
super();
if( ResponseData === undefined )
{
this.statusCode = -1;
this.Data = new Buffer( 0 );
}
else
{
this.statusCode = Response.statusCode;
this.Data = ResponseData;
}
this.Response = Response;
}
get Headers()
{
return this.Response.headers;
}
get ResponseString()
{
return this.Data.toString( "utf-8" );
}
}
module.exports = HttpRequestComplete;

20
net/events/PostRequest.js Normal file
View File

@@ -0,0 +1,20 @@
"use strict";
var qstr = require( "querystring" );
var EventArgs = require( "./EventArgs" );
class PostRequestEventArgs extends EventArgs
{
constructor( QueryString )
{
super();
this.Raw = QueryString;
}
get Data()
{
return qstr.parse( this.Raw );
}
}
module.exports = PostRequestEventArgs;