Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
48 lines (35 loc) · 1.3 KB

File metadata and controls

48 lines (35 loc) · 1.3 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>Data sync</title>
<script src="/socket.io/socket.io.js"></script>
<script src="https://wzrd.in/standalone/diffsync"></script>
<script>
// if installed from standalone script or browserify / webpack
var DiffSyncClient = diffsync.Client || require('diffsync').Client
// socket.io standalone or browserify / webpack
var socket = window.io || require('socket.io-client')
// pass the connection and the id of the data you want to synchronize
var client = new DiffSyncClient(socket(), "lizhizhou");
var data = {};
client.on('connected', function() {
// the initial data has been loaded,
// you can initialize your application
data = client.getData();
});
client.on('synced', function() {
// an update from the server has been applied
// you can perform the updates in your application now
data = client.getData();
});
client.initialize();
/* --- somewhere in your code --- */
data.randomChange = Math.random();
// schedule a sync cycle - this will sync your changes to the server
client.sync();
</script>
</head>
<body>
</body>
</html>
Morty Proxy This is a proxified and sanitized view of the page, visit original site.