refactor: move plugin hook methods to plugin.hooks.*

This commit is contained in:
Julian Lam
2020-11-20 16:06:26 -05:00
parent 3b1c03ed50
commit 6e2da9966e
136 changed files with 550 additions and 541 deletions

View File

@@ -39,7 +39,7 @@ async function rewrite(req, res, next) {
const pathname = parsedUrl.pathname;
const hook = 'action:homepage.get:' + pathname;
if (!plugins.hasListeners(hook)) {
if (!plugins.hooks.hasListeners(hook)) {
req.url = req.path + (!req.path.endsWith('/') ? '/' : '') + pathname;
} else {
res.locals.homePageRoute = pathname;
@@ -54,7 +54,7 @@ exports.rewrite = rewrite;
function pluginHook(req, res, next) {
var hook = 'action:homepage.get:' + res.locals.homePageRoute;
plugins.fireHook(hook, {
plugins.hooks.fire(hook, {
req: req,
res: res,
next: next,