Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X
Hello, how can I implement a complete stop of the script so that, under some condition, the script is not interrupted, not paused, namely, it stops working (I take into account that the script is launched once, without using Autorefresh). The script is not cyclical, a full stop could happen at any moment of the script execution.
Solved! Go to Solution.
What is the actual use case?
It is very rare that you would just 'stop' a script.
Often you would use if/then/else statements (perhaps with some properties to see which way execution should go)
or if you are doing a loop you would use 'break'
What is the actual use case?
It is very rare that you would just 'stop' a script.
Often you would use if/then/else statements (perhaps with some properties to see which way execution should go)
or if you are doing a loop you would use 'break'
You can use a self executing function to encapsule you whole service and then use a return statement to stop it whenever you want.
const result = (function() {
// Your service code
})();
Or if you prefer the arrow notation:
const result = (() => {
// Your service code
})();