update structure

This commit is contained in:
2016-08-08 18:20:00 +02:00
parent fc530ba37e
commit 8d58e0b2f3
16 changed files with 220 additions and 99 deletions

View File

@ -4,7 +4,11 @@ import * as plugins from "./smartsocket.plugins";
import { Stringmap } from "lik";
import { SocketRole } from "./smartsocket.classes.socketrole";
export interface ISocketFunctionData {
functionName:string,
functionData:any,
responseTimeout?:number
};
export interface SocketFunctionOptions {
name: string;
@ -16,9 +20,31 @@ export class SocketFunction {
name: string;
func: any;
roles: SocketRole[];
/**
* the constructor for SocketFunction
*/
constructor(optionsArg: SocketFunctionOptions) {
this.name = optionsArg.name;
this.func = optionsArg.func;
this.roles = optionsArg.roles;
for (let socketRoleArg of this.roles){
this._notifyRole(socketRoleArg);
}
};
/**
* notifies a role about access to this SocketFunction
*/
private _notifyRole(socketRoleArg:SocketRole){
socketRoleArg.addSocketFunction(this);
}
/**
* handles a function request to this SocketFunction
*/
functionRequest(dataArg:ISocketFunctionData){
};
}