smartsocket/dist/smartsocket.classes.socketfunction.js

36 lines
1.7 KiB
JavaScript
Raw Normal View History

2016-08-07 16:59:39 +00:00
"use strict";
;
2016-08-08 16:20:00 +00:00
;
2016-08-09 09:42:21 +00:00
;
// export classes
/**
* class SocketFunction respresents a function that can be transparently called using a SocketConnection
*/
2016-08-07 16:59:39 +00:00
class SocketFunction {
2016-08-09 09:42:21 +00:00
/**
* the constructor for SocketFunction
*/
2016-08-07 16:59:39 +00:00
constructor(optionsArg) {
this.name = optionsArg.name;
this.func = optionsArg.func;
this.roles = optionsArg.roles;
2016-08-08 16:20:00 +00:00
for (let socketRoleArg of this.roles) {
this._notifyRole(socketRoleArg);
}
2016-08-07 16:59:39 +00:00
}
;
2016-08-09 09:42:21 +00:00
/**
* notifies a role about access to this SocketFunction
*/
2016-08-08 16:20:00 +00:00
_notifyRole(socketRoleArg) {
socketRoleArg.addSocketFunction(this);
}
2016-08-09 09:42:21 +00:00
/**
* invokes the function of this SocketFunction
*/
invoke(dataArg) {
2016-08-08 16:20:00 +00:00
}
2016-08-09 09:42:21 +00:00
;
2016-08-07 16:59:39 +00:00
}
exports.SocketFunction = SocketFunction;
2016-08-09 09:42:21 +00:00
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzb2NrZXQuY2xhc3Nlcy5zb2NrZXRmdW5jdGlvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0c29ja2V0LmNsYXNzZXMuc29ja2V0ZnVuY3Rpb24udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQWFDLENBQUM7QUFLRCxDQUFDO0FBTUQsQ0FBQztBQUVGLGlCQUFpQjtBQUVqQjs7R0FFRztBQUNIO0lBS0k7O09BRUc7SUFDSCxZQUFZLFVBQWlDO1FBQ3pDLElBQUksQ0FBQyxJQUFJLEdBQUcsVUFBVSxDQUFDLElBQUksQ0FBQztRQUM1QixJQUFJLENBQUMsSUFBSSxHQUFHLFVBQVUsQ0FBQyxJQUFJLENBQUM7UUFDNUIsSUFBSSxDQUFDLEtBQUssR0FBRyxVQUFVLENBQUMsS0FBSyxDQUFDO1FBQzlCLEdBQUcsQ0FBQyxDQUFDLElBQUksYUFBYSxJQUFJLElBQUksQ0FBQyxLQUFLLENBQUMsQ0FBQSxDQUFDO1lBQ2xDLElBQUksQ0FBQyxXQUFXLENBQUMsYUFBYSxDQUFDLENBQUM7UUFDcEMsQ0FBQztJQUNMLENBQUM7O0lBRUQ7O09BRUc7SUFDSyxXQUFXLENBQUMsYUFBd0I7UUFDeEMsYUFBYSxDQUFDLGlCQUFpQixDQUFDLElBQUksQ0FBQyxDQUFDO0lBQzFDLENBQUM7SUFFRDs7T0FFRztJQUNILE1BQU0sQ0FBQyxPQUFvQztJQUUzQyxDQUFDOztBQUVMLENBQUM7QUEvQlksc0JBQWMsaUJBK0IxQixDQUFBIn0=