How do I interact with the IndexedDB (LocalStorage)?

0 favourites
  • 4 posts
From the Asset Store
Unlock platyers earning coins, and save it with Localstorage
  • Hello, first time poster so please be patient

    I'm trying to embed a game in a website with an iframe, and have a way to send/receive messages to/from the game.

    From my understanding the implementation of the LocalStorage of Construct 3 is the IndexedDB for the browser, but after messing a bit around it I removed the "keyvaluepair" object store and is not being created again by the game.

    1) How to fix the issue? Should I just manually create the object store again?

    2) If there is any, what is a cleaner way to do this kind of interaction between the browser and the information of the game? Is the LocalStorage the way or are there other components I am missing?

    Thank you in advance

    (This question could have been already asked by me, but for some reason the post was not published :( )

  • The "uniqueID" is generated when you create a new project in C3 and you can find it in .caproj file.

    So if you can't restore the object store, I think you can change the uniqueID to a random string, and the store should be re-generated next time you run the project.

  • Use the IStorage JavaScript API to integrate custom code with the Local Storage object's data.

    The database is only created on demand, so if you delete it, it won't come back until it attempts to write new data.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I found the "uniqueID" in the project.c3proj file when saving it as a folder as mentioned!

    I will also check the IStorage Javascript API

    Thank you both for your answers 🙏

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)