Raste
Raste

Reputation: 376

Good way to initialize Nativescript Vue App

I'm looking for a good way to initialize my app (create database, populate database, download assets etc.) on its first startup.

All I can think of right now is to use @loaded event or the created method in combination with some flags in the key-value storage. This feels like it might be too much of a dirty workarround tho.

Is there a "proper way" to do this?

Upvotes: 1

Views: 87

Answers (1)

Robertino Vasilescu
Robertino Vasilescu

Reputation: 1078

You can use nativescript-secure-storage which has a method isFirstRun() or isFirstRunSync() which you can call to check if it is the first app run.

Accordingly you can do your stuff in the callback of this function.

Add your code in app.js and you're set.

Upvotes: 1

Related Questions