p6-service
v0.0.7
Published
Extendable service system
Downloads
3
Readme
p6-service
Hooks - The heart of our system
Types
before-global
- Run before all servicebefore-service
- Run before a service, detect by SIDafter-service
- Run after a service, , detect by SIDafter-global
- Run after all service
How to result of service will be solve?
- Run
before-global
->beforeGlobalResult
.ServiceResult
isbeforeGlobalResult
- Run
before-service
with latest params isServiceResult
->beforeServiceResult
.ServiceResult
isObject.assign({}, ServiceResult, beforeServiceResult)
- Run
after-service
with latest params isServiceResult
->afterServiceResult
.ServiceResult
isObject.assign({}, ServiceResult, afterServiceResult)
- Run
after-global
with ONE params isServiceResult
->afterGlobalResult
.ServiceResult
isObject.assign({}, ServiceResult, afterGlobalResult)
- Return
ServiceResult
Break the chain
You cann break the chain of hook by using flag __break
on your return result.
before-global
-> break after run ALLbefore-global
hooksbefore-service
-> break after run ALLbefore-global
andbefore-service
hookshandler
-> break after run ALLbefore-global
,before-service
hooks an your mainhandler
after-service
-> break after run ALLbefore-global
,before-service
hooks, your mainhandler
andafter-service
after-global
As default mode, your service will run through your handler and all hooks