Reputation: 117
I have created a function, which contains some configuration for a partial.
I want to call this this function in my xy-view.page.js. I tried to create a helper, because in the docs they wrote
Helpers can be called from almost anywhere in your code; as long as that place has access to the sails app instance.
But in my xy-view.page.js I have no sails instance so i cant write this.sails.helpers.MyHelper(x,y,z);
Is there an alternative, so I can use this function in multiple .page.js?
Upvotes: 1
Views: 502
Reputation: 399
Helpers
are for backend code, they help you share code between different actions and helpers. In frontend code, you can do the same thing with "utilities" as defined by Parasails - for more info: check out the Sails.JS Platzi course and have a peak at the assets/js/utilities
folder in your app.
Upvotes: 4