Hi all, I am trying to pass the $item callback from a repeater’s input to a backend function so that I could set the properties of frontend elements from the back end. I want to do this as it is my understanding that backend functions are not visible to users, and I presume that my website would be secure if users could not see how I am assigning data to elements. However, I am getting the error below when I run the code below, but am not receiving the error when I move the backend code below to the frontend.
Is what I am trying to do possible?
How can I fix if so?
Does it make sense to do this for security purposes?
Thanks for your help!
Front End:
import {connectData} from "backend/dataConnections.jsw"
export function repeater_itemReady($item, itemData, index) {
connectData($item, itemData, "#image");
}
Back End:
export function connectData(selectorCallback, item, elementID) {
console.log(selectorCallback);
console.log(typeof(selectorCallback));
selectorCallback(elementID).src = item.img;
}
Console
undefined
object
...
undefined
object
Error: selectorCallback is not a function