Multi window application - Persistent JS

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Multi window application - Persistent JS

Postby doa » Tue Feb 20, 2018 7:11 am

Hello,

I am currently playing around with cef, the ultimate goal being to use cef/HTML as a user interface for my application.
Everything works great so far but i still have one question for which i can't find a clear answer.

I have some javascript functions/variables that are used by nearly every window (General libs / Some session data...)
For my protoype i load this in every new instance.
This works but seems like it is not the best way to archieve this.

So my question is, what is the recommended/best way to have "persistent/global" javascript in the whole session, independet of the open window?
I understand that each instance has its own V8 context, so i was thinking some "hidden" backround window whith which I can communicate perhaps?
doa
Newbie
 
Posts: 1
Joined: Tue Feb 20, 2018 7:01 am

Re: Multi window application - Persistent JS

Postby magreenblatt » Tue Feb 20, 2018 11:47 am

The simplest implementation would likely be a JS file that's included by all of your HTML files and that loads/stores state in localStorage. If you're looking for greater persistence (like a service that keeps running) you can try service workers: https://developers.google.com/web/funda ... e-workers/
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm


Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 42 guests

cron