Re: Static data for web pages

Melvin Carvalho <[email protected]> Sun, 10 May 2020 11:27:45 +0200
Newsgroups gmane.org.w3c.tag
Message-ID <CAKaEYh+xVNMR6t5uW3ww5qobwntOndaNcsSTadzBA20TaKAMtA@mail.gmail.com>
--0000000000007d2c1b05a547d863
Content-Type: text/plain; charset="UTF-8"

On Sun, 10 May 2020 at 11:09, Melvin Carvalho <[email protected]>
wrote:

> Hi Tag
>
> I wanted to ask about a possible data model for the web.  Whether it
> exists, or whether or not it's a good idea.
>
> It revolves around the popular idea of Single Page Applications (SPA) and
> "static" data.  Single pages applications written in JS are well
> understood, I am going to consider an app without routes, so truly a
> "single page" SPA.
>
> State management is a common challenge.  Where the state of the app is
> kept in a self contained store of some kind.
>
> The problem is that when you reload the app the store will reset itself
> and the variables will not remember where they were when they left off.
>
> Other languages have a solution for this called "static" variables.  Ones
> that remain constant to a degree.  But I dont think we have "static"
> variables on the web, AFAIK.
>
> A typical work around to this would be to have some kind of REST API with
> a server running to maintain that API and perhaps a bearer token to
> authenticate and allow you to save state.  That's quite an overhead.
>
> What if, instead an SPA were to have a static part.  Perhaps readers of
> this list are familiar with "data islands", a bunch of data that is stored
> in a script tag and is global.  This could be in turn used to initialize
> the app.
>
> What if you could use that global data to bootstrap your SPA and indeed
> change it, and keep it persistent.  A method to do this could be along
> Timbl's ideas of a read write web where you send a bearer token and PUT the
> data back to the page you are looking at.  But only change the data
> island.  The app itself could be a single line shim.
>
> Could this be a solution to create persistent static data for web pages
> and single pages apps, on the web?
>
> Would love to hear if there's any existing solutions to this, or any
> feedback
>
> Best
> Melvin
>

Let me add the class of storage APIs such as SessionStorage, LocalStorage,
Cookies, File System API, WebSQL etc. as mentioned here:

https://web.dev/storage-for-the-web/

The static variable idea relates more to something in the page itself (body
or head)

--0000000000007d2c1b05a547d863
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><br></div><br><div class=3D"gmail_quote">=
<div dir=3D"ltr" class=3D"gmail_attr">On Sun, 10 May 2020 at 11:09, Melvin =
Carvalho &lt;<a href=3D"mailto:[email protected]">melvincarvalho@gma=
il.com</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"m=
argin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left=
:1ex"><div dir=3D"ltr"><div>Hi Tag</div><div><br></div><div>I wanted to ask=
 about a possible data model for the web.=C2=A0 Whether it exists, or wheth=
er or not it&#39;s a good idea.</div><div><br></div><div>It revolves around=
 the popular idea of Single Page Applications (SPA) and &quot;static&quot; =
data.=C2=A0 Single pages applications written in JS are well understood, I =
am going to consider an app without routes, so truly a &quot;single page&qu=
ot; SPA.</div><div><br></div><div>State management is a common challenge.=
=C2=A0 Where the state of the app is kept in a self contained store of some=
 kind.</div><div><br></div><div>The problem is that when you reload the app=
 the store will reset itself and the variables will not remember where they=
 were when they left off.=C2=A0 <br></div><div><br></div><div>Other languag=
es have a solution for this called &quot;static&quot; variables.=C2=A0 Ones=
 that remain constant to a degree.=C2=A0 But I dont think we have &quot;sta=
tic&quot; variables on the web, AFAIK.</div><div><br></div><div>A typical w=
ork around to this would be to have some kind of REST API with a server run=
ning to maintain that API and perhaps a bearer token to authenticate and al=
low you to save state.=C2=A0 That&#39;s quite an overhead.</div><div><br></=
div><div>What if, instead an SPA were to have a static part.=C2=A0 Perhaps =
readers of this list are familiar with &quot;data islands&quot;, a bunch of=
 data that is stored in a script tag and is global.=C2=A0 This could be in =
turn used to initialize the app.<br></div><div><br></div><div>What if you c=
ould use that global data to bootstrap your SPA and indeed change it, and k=
eep it persistent.=C2=A0 A method to do this could be along Timbl&#39;s ide=
as of a read write web where you send a bearer token and PUT the data back =
to the page you are looking at.=C2=A0 But only change the data island.=C2=
=A0 The app itself could be a single line shim.<br></div><div><br></div><di=
v>Could this be a solution to create persistent static data for web pages a=
nd single pages apps, on the web?</div><div><br></div><div>Would love to he=
ar if there&#39;s any existing solutions to this, or any feedback</div><div=
><br></div><div>Best</div><div>Melvin<br></div></div></blockquote><div><br>=
</div><div>Let me add the class of storage APIs such as SessionStorage, Loc=
alStorage, Cookies, File System API, WebSQL etc. as mentioned here:</div><d=
iv><br></div><div><a href=3D"https://web.dev/storage-for-the-web/">https://=
web.dev/storage-for-the-web/</a></div><div><br></div><div>The static variab=
le idea relates more to something in the page itself (body or head)<br> </d=
iv></div></div>

--0000000000007d2c1b05a547d863--