back soft

مطالب مرتبط با «js function was used before it was defined» در back soft | نویسنده: استخدام کار

JS function used globally in multiple files

Vote count: 0 The title was kind of hard to write correctly, so I hope I can explain this well enough. I have a function defined in the main function of my application... let renderTemplate = (req, res, view, model) => { res.render('template', { 'view': view, 'model': model }); } And then I use it in multiple, small controller-esque files, like so let foo = (req, res) => { renderTemplate(req, res, 'index', {}); } The question is: How do I include renderTemplate in all of my controller-esque classes without placing it in or injecting the code per file? asked 26 secs agoLiam Mueller Let's block ads! بخوانید...

ادامه مطلب

برچسب‌های مرتبط

js function was used before it was defined