cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

Full script stop

OI_8877786
3-Visitor

Full script stop

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.

1 ACCEPTED SOLUTION

Accepted Solutions
PaiChung
22-Sapphire I
(To:OI_8877786)

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'

View solution in original post

2 REPLIES 2
PaiChung
22-Sapphire I
(To:OI_8877786)

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'

DanZ
15-Moonstone
(To:OI_8877786)

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
})();

 

Top Tags