c# - auto generate javascript to update client html compared to previous html? -


do think difficult write framework mvc compares last html output current html want output, , instead of sending entire html, figure out has changed , generate js code updating compared previous html? (presuming nothing manually changed on client using js)... maybe idea codeplex project? or maybe exists? if so, tell. thanks.

i think it's interesting question, 1 without practical solution..

if understand correctly want generate diff current dom new one, , want generate change script (which javascript executed client side) on server.

the issue in order server generate diff, needs know previous dom structure in order compare new 1 (i.e. new html page)

the ways can think of are:

1. client sends full current page or representation of it. 2. server stores copy of previous page. 

the problem #1 you've negated performance benefit it. sending full page server bad or worse sending server client. can achieve same effect requesting full page body via ajax , replacing it, , efficient , simpler implement.

the problem #2 server needs x copies of each page x number of users. that's lot of memory, unless you're persisting disk, in case that's a moderate sized disk write every request. there's problem of figuring out how long keep these around, because if visits site once, don't want keep around forever.

the performance of either situation going worse getting full page , worse more users.

that's not including complexity of getting right. think hypothetically done, other fun experiment there aren't practical benefits outweigh cost of such solution, why doubt you'll find one.


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -