You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

jsyncdb_index_v4.html 5.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <html itemscope itemtype="http://schema.org/Product" prefix="og: http://ogp.me/ns#" xmlns="http://www.w3.org/1999/html">
  2. <head>
  3. <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0" />
  4. <script class="win_keys2 win_keys_glob_attrs" src="/ign/j9/dbg/glob_attrs.js?c=00x"></script>
  5. <script src="/ign/libs/jquery-3.5.1.min.js"></script>
  6. <script class="win_keys" src="/ign/j9/dbg/win_keys.js?c=00x"></script>
  7. <script class="rld" src="/ign/indx/jsyncdb/jsync_dep.js"></script>
  8. <script class="win_keys" src="/ign/j9/dbg/win_keys.js?c=00x"></script>
  9. <script class="rld" src="/ign/indx/jsyncdb/jsync_ord.js"></script>
  10. <script class="win_keys" src="/ign/j9/dbg/win_keys.js?c=00x"></script>
  11. <script class="rld" src="/ign/indx/jsyncdb/jsync_ws.js"></script>
  12. <script class="win_keys" src="/ign/j9/dbg/win_keys.js?c=00x"></script>
  13. <script class="rld" src="/ign/indx/jsyncdb/jsync_sto.js"></script>
  14. <script class="win_keys" src="/ign/j9/dbg/win_keys.js?c=00x"></script>
  15. <script class="rld" src="/ign/indx/jsyncdb/jsync_init.js"></script>
  16. <script class="win_keys" src="/ign/j9/dbg/win_keys.js?c=00x"></script>
  17. <script class="rld" src="/ign/indx/jsyncdb/jsync_test.js"></script>
  18. <script class="win_keys" src="/ign/j9/dbg/win_keys.js?c=00x"></script>
  19. <script class="rld" src="/ign/indx/jsyncdb/jsync_demo.js"></script>
  20. <script class="win_keys" src="/ign/j9/dbg/win_keys.js?c=00x"></script>
  21. <script class="rld" src="/ign/indx/jsyncdb/jsync_test2.js"></script>
  22. <script class="win_keys" src="/ign/j9/dbg/win_keys.js?c=00x"></script>
  23. <!--
  24. -->
  25. <!-- <script class="rld" src="/jsync_lib.js"></script> -->
  26. <!-- <script class="rld" src="/jsync_demo.js"></script> -->
  27. <!-- <script class="rld z1" src="jsync_demo.js"></script> -->
  28. <style type="text/css">
  29. </style>
  30. <!-- <link class="rld" rel="stylesheet" href="/jsync_demo.css"> -->
  31. <!-- <link class="rld" rel="stylesheet" href="jsync_demo.css"> -->
  32. <link class="rld" rel="stylesheet" href="/ign/indx/jsyncdb/jsync_demo.css">
  33. <script class="win_keys" src="/ign/j9/dbg/win_keys.js?c=00x"></script>
  34. <script src="/ign/j7/rldjs/rldjs5.js?v=139"></script>
  35. <script class="rld rrld" src="/ign/rls.js?<!--#echo var='rtqs'-->"></script>
  36. <script class="rld rrld_u" src="/ign/rls_u.js?<!--#echo var='rtqs'-->"></script>
  37. <script type="text/javascript">
  38. window.nginx_v1 = {
  39. "target_server_name":`<!--#echo var="target_server_name"-->`,
  40. "ssl_server_name":`<!--#echo var="ssl_server_name"-->`,
  41. ssl_certificate: `/etc/letsencrypt/live/<!--#echo var="target_server_name"-->/fullchain.pem`,
  42. ssl_certificate_key: `/etc/letsencrypt/live/<!--#echo var="target_server_name"-->/privkey.pem`,
  43. }
  44. function hide_demo(argument) {
  45. clog("hide_demo")
  46. $(".show_demo").removeClass("show_demo").addClass("hide_demo")
  47. }
  48. function show_demo(argument) {
  49. clog("show_demo")
  50. // body...
  51. $(".hide_demo").removeClass("hide_demo").addClass("show_demo")
  52. }
  53. </script>
  54. </head>
  55. <body>
  56. <div id="root_div">
  57. <span class="iblock_2"></span>
  58. <span class="iblock_1"></span>
  59. </div>
  60. <div class="json_container hide_demo">
  61. <button class="demo_hide_btn" onclick="hide_demo()">hide demo</button>
  62. <button class="demo_show_btn" onclick="show_demo()">show demo</button><br>
  63. <!-- <div class="db_disp"></div> -->
  64. <code class="db_disp"></code>
  65. </div>
  66. <div id="oops_i_lied"><div class="code_container">
  67. in this demo the global variable msto_prx is the root of the database.
  68. we will use the global variable msto because it is a little nicer (has shortcuts to the parts you have exclusive write permissions to).
  69. <b>open devtools on two pages connected to the same database to begin</b>
  70. to get a copy of the datastructure without the Proxies:
  71. <code>jc(msto)</code><div class="hidden-boundary"></div>
  72. set values<code>
  73. msto.key = "value"<div class="hidden-boundary"></div>
  74. msto.example = {
  75. str:"these are supported data types",
  76. number:12.7,
  77. bool:true,
  78. arr:["val0",1,{z:1},["a","b"]],
  79. obj:{d:"there is a max depth of 15"},
  80. str2:"null isn't fully supported yet and can break things",
  81. }
  82. </code>
  83. you can paste this shorter statement to avoid newlines in your devtools history :)
  84. <code>msto.example={str:"str_val",bool:true,number:12.7,arr:["val0",1,{z:2},["a","b"]],obj:{d:"depth 2?"},str2:"another string"}</code><div class="hidden-boundary"></div>
  85. get values
  86. <code>
  87. msto.example.arr[0]<div class="hidden-boundary"></div>
  88. // "val0"
  89. msto.example.arr[2]<div class="hidden-boundary"></div>
  90. // {z:2}</code>
  91. the datastructure should have syncronized msto & msto_prx on both webpages
  92. <span class="db_desc">
  93. values can be strings, numbers, booleans, objects or arrays
  94. null and undefined are not supported yet
  95. local changes are immediate
  96. and deletes are local only (for now)
  97. after a value is set is pushed to everyone else who is connected
  98. msto.ws_channels and msto.participants are write protected
  99. msto.my_data links to the path you have write access to as does msto.my_channel
  100. participants and channels write only data are automatically deleted after they leave
  101. the data is not persistent it exists in the webpages of those connected
  102. if everyone leaves a room the datastructure is destroyed
  103. </span></div></div>
  104. </body>
  105. </html>