2020-06-05 22:03:37 +00:00
|
|
|
from typing import Callable, List
|
2017-02-04 00:08:12 +00:00
|
|
|
|
2020-06-05 22:03:37 +00:00
|
|
|
from szurubooru.rest.context import Context
|
2017-02-04 00:08:12 +00:00
|
|
|
|
|
|
|
pre_hooks = [] # type: List[Callable[[Context], None]]
|
|
|
|
post_hooks = [] # type: List[Callable[[Context], None]]
|
2016-08-14 10:35:14 +00:00
|
|
|
|
2016-08-14 12:22:53 +00:00
|
|
|
|
2017-02-04 00:08:12 +00:00
|
|
|
def pre_hook(handler: Callable) -> None:
|
2016-08-14 10:35:14 +00:00
|
|
|
pre_hooks.append(handler)
|
|
|
|
|
2016-08-14 12:22:53 +00:00
|
|
|
|
2017-02-04 00:08:12 +00:00
|
|
|
def post_hook(handler: Callable) -> None:
|
2016-08-14 10:35:14 +00:00
|
|
|
post_hooks.insert(0, handler)
|