[node-red-dashboard] Sharing code with initController

Hey y'all!
I have a question that's come up every now and then, I haven't made any headway and was wondering if the forum has any ideas! Understanding that the value for the initController option passed to addWidget is evaluated in a frontend Angular scope, passed from the backend as a string, this requirement means only code present at backend runtime within one's initController method will be included and any code not within the scope will be most likely undefined. This means one cannot simply call a shared piece of code from initController, instead it has to be copied, often duplicated!

My question is has anyone found a novel way to rectify this situation? Is there a tricky tricky Javascript way to grab functions declared within one's initController? Has anyone messed with appending+evaling their initController with a shared function and passing the result into their addWidget call? Is there a preprocessor that can inline marked functions before publishing?

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.