Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to call js functions? #213

Closed
cryptoBOOOOM opened this issue Jun 6, 2018 · 1 comment
Closed

How to call js functions? #213

cryptoBOOOOM opened this issue Jun 6, 2018 · 1 comment
Labels

Comments

@cryptoBOOOOM
Copy link

I include a js file in my main template and i want to call a function from that within a view but it sais the function is not defined... How can i include functions?

@bminer
Copy link
Owner

bminer commented Jun 7, 2018

You can expose the function by passing it into the view at render-time.

Example (passing the sum function into a view):

const sum = (a, b) => a + b;
const locals = {sum};
tmpl(locals, cb)

@bminer bminer closed this as completed Jun 7, 2018
@bminer bminer added the question label Jun 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants