Skip to content

Duplicated function calls #13048

Answered by m1ga
beppo-ivel asked this question in Q&A
Discussion options

You must be logged in to vote

How would the SDK decide if that function is unnecessary to call a second time? You have to do that yourself and a simple if check at the beginning is nothing expensive especially if it doesn't run expensive functions that are not needed.
You can use Ti.App.Properties for that: https://titaniumsdk.com/api/titanium/app/properties.html have a look at the examples and especially the getBool method. Check if with default:false and set it to true at the end of your if block. Next time you start your app it will be true and the if will be ignored.

Otherwise you can check for a file if you want to make sure that it exists! Keep in mind that it might be deleted somewhere else and your variable is…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by beppo-ivel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants