0.0.7 • Published 6 years ago

p6-service v0.0.7

Weekly downloads
2
License
MIT
Repository
-
Last release
6 years ago

p6-service

Hooks - The heart of our system

Types

  • before-global - Run before all service
  • before-service - Run before a service, detect by SID
  • after-service - Run after a service, , detect by SID
  • after-global - Run after all service

How to result of service will be solve?

  • Run before-global -> beforeGlobalResult. ServiceResult is beforeGlobalResult
  • Run before-service with latest params is ServiceResult -> beforeServiceResult. ServiceResult is Object.assign({}, ServiceResult, beforeServiceResult)
  • Run after-service with latest params is ServiceResult -> afterServiceResult. ServiceResult is Object.assign({}, ServiceResult, afterServiceResult)
  • Run after-global with ONE params is ServiceResult -> afterGlobalResult. ServiceResult is Object.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 ALL before-global hooks
  • before-service -> break after run ALL before-global and before-service hooks
  • handler -> break after run ALL before-global, before-service hooks an your main handler
  • after-service -> break after run ALL before-global, before-service hooks, your main handler and after-service
  • after-global As default mode, your service will run through your handler and all hooks
0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago