Hello, I am trying to make dynamic JavaScript push on the webview by EvaluateJS
for example, my evaluateJS code is
<OnUserEvent EventName="myGlobalEvent">
<EvaluateJS JavaScript="{InjectJs}" />
</OnUserEvent>
and the initial InjectJs is
var InjectJs = Observable("$('body').prepend('<hr>heelo</hr>');");
And it makes ‘heelo’ message and hr line on the top of the body,
next, I want change the InjectJs Dynamically, so I change the value of the InjectJs and check the value
InjectJs.value = "$('body').prepend('<hr>second value</hr>');"
console.log(InjectJs.value);
when I check the value of InjectJs by console.log, it changed properly,
HOWEVER, when I triggered UserEvent again, the value was not changed.
its output is still ‘heelo’, the initial value of InjectJS.
I tried several ways to change the JavaScript Value of EvaluateJS
- Change it on embeded .js as above
- make ux:Global(Injector) on EvaluateJS and make Change on Injector.JavaScript
- Make the InjectJs normal variable (not observable) and change it
- Make the InjectJs global variable and change it
but nothing works… the initial value of JavaScript seems static…
Is there any other way to change the initial JavaScript Value of EvaluateJS