Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

OnInstall event?

Trying to figure out how to delete and re-create the file where I save the settings for my clockface whenever the app is re-installed.  Is there an event that fires on installation?  Or is there some other way to perform a certain function only when the app is first installed?

 

Thanks.

Best Answer
0 Votes
1 REPLY 1

There's not an API for this, but you can write a file to the file system containing a version number, or check for the existence of a particular version of the settings file. e.g.

 

 

try {
settings = fs.readFileSync("settings-v2.cbor", "cbor");
} catch(ex) {}
if (!settings) {
try {
settings = fs.readFileSync("settings.cbor", "cbor");
} catch (ex) {
settings = defaults;
}
}

 

 

Best Answer
0 Votes