mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
add filter support
This commit is contained in:
parent
40a7278aa5
commit
1ec8baa459
1 changed files with 7 additions and 0 deletions
|
@ -25,6 +25,13 @@ def runHook(hook, *args):
|
|||
for func in hook:
|
||||
func(*args)
|
||||
|
||||
def runFilter(hook, arg):
|
||||
hook = _hooks.get(hook, None)
|
||||
if hook:
|
||||
for func in hook:
|
||||
arg = func(arg)
|
||||
return arg
|
||||
|
||||
def addHook(hook, func):
|
||||
"Add a function to hook. Ignore if already on hook."
|
||||
if not _hooks.get(hook, None):
|
||||
|
|
Loading…
Reference in a new issue