mirror of
https://github.com/ankitects/anki.git
synced 2025-11-12 15:47:12 -05: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:
|
for func in hook:
|
||||||
func(*args)
|
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):
|
def addHook(hook, func):
|
||||||
"Add a function to hook. Ignore if already on hook."
|
"Add a function to hook. Ignore if already on hook."
|
||||||
if not _hooks.get(hook, None):
|
if not _hooks.get(hook, None):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue