1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- <!DOCTYPE html>
- <html lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta name="viewport" content="width=device-width, initial-scale=1"/>
-
- <title>Serialize-javascript: ver 6.0.0c, no npm requirements</title>
- <link rel="shortcut icon" href="./favicon.ico" />
- <meta name="description" content="The complete serialization solution from Yahoo"/>
- <meta name="keywords" content="5 Mode,object"/>
- <meta name="robots" content="index,follow"/>
- <meta name="author" content="5 Mode"/>
-
- <script src="./serialize-javascript.js" type="text/javascript"></script>
-
- <link href="./css/style.css" type="text/css" rel="stylesheet">
-
- <script type="text/javascript">
- function myObj() {
-
- const s = "Hello World!";
-
- // Properties
- this.msg = s;
- this.start = mystart;
-
- // Methods
- function mystart() {
- alert(this.msg);
- }
-
- }
- function serializeDemo() {
- thiss = new myObj();
- alert(serialize(thiss));
- }
- function deserializeDemo() {
- thiss = new myObj();
- s = serialize(thiss);
- thatt = deserialize(s);
- thatt.start();
- }
- </script>
- </head>
- <body style="margin-top:20px;">
- <div style="text-align:center;">
- Given the following object:<br><br>
- <pre style="width:300px; margin:auto; background: lightgray; text-align:left">
-
- function myObj() {
-
- const s = "Hello World!";
-
- // Properties
- this.msg = s;
- this.start = mystart;
-
- // Methods
- function mystart() {
- alert(this.msg);
- }
-
- }
-
- </pre>
- <br>
- <input type="button" id="butSerializeDemo" value="Serialize demo" onclick="serializeDemo()">
- <br><br>
- <input type="button" id="butDeserializeDemo" value="Deserialize demo" onclick="deserializeDemo()">
- </div>
- </body>
- </html>
|