Object Chain
message handler chain processing object
The message handler chain processing object is used to link a series of message handlers and process them in a chain according to the specified order. Create method:
1
2
3var chain = new mq.Chain([
func1, func2
]);
inheritance relationship
Constructor
Chain
Constructs a message handler chain processing object
1new Chain(Array hdlrs);
Call parameters:
- hdlrs: Array, array of handlers
member function
append
Add an array of processors
1Chain.append(Array hdlrs);
Call parameters:
- hdlrs: Array, array of handlers
add processor
1Chain.append(Handler hdlr);
Call parameters:
- hdlr:Handler, built-in message handlers, handler functions, chained processing arrays, routing objects, see detailsmq.Handler
invoke
handle a message or object
1Handler Chain.invoke(object v) async;
Call parameters:
- v:object, specifies the message or object to process
Return result:
- Handler, return to the next handler
toString
Returns the string representation of the object, generally returns "[Native Object]", the object can be reimplemented according to its own characteristics
1String Chain.toString();
Return result:
- String, returns the string representation of the object
toJSON
Returns the JSON format representation of the object, generally returns the set of readable properties defined by the object
1Value Chain.toJSON(String key = "");
Call parameters:
- key: String, unused
Return result:
- Value, returns a value containing JSON serializable