Re: Static data for web pages

Stringfellow Cris <[email protected]> Thu, 28 May 2020 08:39:47 +0000
Newsgroups gmane.org.w3c.tag
Message-ID <PS2PR03MB366950F6AF347C6A3704B1A4E38E0@PS2PR03MB3669.apcprd03.prod.outlook.com>
--_000_PS2PR03MB366950F6AF347C6A3704B1A4E38E0PS2PR03MB3669apcp_
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

You could always take a look at this pattern for loading state from the ser=
ver, and picking it up on the client

https://github.com/cris691/servedata/blob/master/_views/loginlink.js#L19

Cris
________________________________
From: Melvin Carvalho <[email protected]>
Sent: Sunday, May 10, 2020 5:09 PM
To: TAG List <[email protected]>; Tim Berners-Lee <[email protected]>
Subject: Static data for web pages

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 t=
hat remain constant to a degree.  But I dont think we have "static" variabl=
es 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 authenti=
cate 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 thi=
s 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 a=
pp.

What if you could use that global data to bootstrap your SPA and indeed cha=
nge 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 b=
ack 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 feedba=
ck

Best
Melvin

--_000_PS2PR03MB366950F6AF347C6A3704B1A4E38E0PS2PR03MB3669apcp_
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html>
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dus-ascii"=
>
</head>
<body>
<div>You could always take a look at this pattern for loading state from th=
e server, and picking it up on the client</div>
<div><br>
</div>
<div>https://github.com/cris691/servedata/blob/master/_views/loginlink.js#L=
19<br>
</div>
<div><br>
</div>
<div>Cris</div>
<hr style=3D"display:inline-block;width:98%" tabindex=3D"-1">
<div id=3D"divRplyFwdMsg" dir=3D"ltr"><font face=3D"Calibri, sans-serif" st=
yle=3D"font-size:11pt" color=3D"#000000"><b>From:</b> Melvin Carvalho &lt;m=
[email protected]&gt;<br>
<b>Sent:</b> Sunday, May 10, 2020 5:09 PM<br>
<b>To:</b> TAG List &lt;[email protected]&gt;; Tim Berners-Lee &lt;[email protected]=
g&gt;<br>
<b>Subject:</b> Static data for web pages</font>
<div>&nbsp;</div>
</div>
<div>
<div dir=3D"ltr">
<div>Hi Tag</div>
<div><br>
</div>
<div>I wanted to ask about a possible data model for the web.&nbsp; Whether=
 it exists, or whether or not it'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.&nbsp; Single pages applications written in JS =
are well understood, I am going to consider an app without routes, so truly=
 a &quot;single page&quot; SPA.</div>
<div><br>
</div>
<div>State management is a common challenge.&nbsp; Where the state of the a=
pp 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 itsel=
f and the variables will not remember where they were when they left off.&n=
bsp;
<br>
</div>
<div><br>
</div>
<div>Other languages have a solution for this called &quot;static&quot; var=
iables.&nbsp; Ones that remain constant to a degree.&nbsp; But I dont think=
 we have &quot;static&quot; variables on the web, AFAIK.</div>
<div><br>
</div>
<div>A typical work around to this would be to have some kind of REST API w=
ith a server running to maintain that API and perhaps a bearer token to aut=
henticate and allow you to save state.&nbsp; That's quite an overhead.</div=
>
<div><br>
</div>
<div>What if, instead an SPA were to have a static part.&nbsp; Perhaps read=
ers of this list are familiar with &quot;data islands&quot;, a bunch of dat=
a that is stored in a script tag and is global.&nbsp; This could be in turn=
 used to initialize the app.<br>
</div>
<div><br>
</div>
<div>What if you could use that global data to bootstrap your SPA and indee=
d change it, and keep it persistent.&nbsp; A method to do this could be alo=
ng 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.&nbsp; But only change the data island.&nbsp; The app itself could be a=
 single line shim.<br>
</div>
<div><br>
</div>
<div>Could this be a solution to create persistent static data for web page=
s and single pages apps, on the web?</div>
<div><br>
</div>
<div>Would love to hear if there's any existing solutions to this, or any f=
eedback</div>
<div><br>
</div>
<div>Best</div>
<div>Melvin<br>
</div>
</div>
</div>
</body>
</html>

--_000_PS2PR03MB366950F6AF347C6A3704B1A4E38E0PS2PR03MB3669apcp_--