Skip to content

Commit

Permalink
Got Vite example to work
Browse files Browse the repository at this point in the history
  • Loading branch information
curran committed Mar 8, 2023
1 parent 280d681 commit 0f4b211
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion examples/counter-json1-vite/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<body>
<div style="font-family: Helvetica Neue, Helvetica, Arial, sans-serif; font-size: 36px;">
You clicked <span id="num-clicks"></span> times.
<button style="font-size: 36px;" onclick="increment()">+1</button>
<button style="font-size: 36px;" class="increment">+1</button>
</div>
<script type="module" src="/main.js"></script>
</body>
Expand Down
6 changes: 3 additions & 3 deletions examples/counter-json1-vite/main.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import ReconnectingWebSocket from 'reconnecting-websocket';
import sharedb from 'sharedb/lib/client';
import json1 from 'ot-json1';
import sharedb from 'sharedb-client-browser/dist/sharedb-client-umd.cjs';

// Open WebSocket connection to ShareDB server
var socket = new ReconnectingWebSocket('ws://' + window.location.host);
Expand Down Expand Up @@ -29,5 +29,5 @@ function increment() {
doc.submitOp(['numClicks', {ena: 1}]);
}

// Expose to index.html
global.increment = increment;
var button = document.querySelector('button.increment');
button.addEventListener('click', increment);
1 change: 1 addition & 0 deletions examples/counter-json1-vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"ot-json1": "^1.0.2",
"reconnecting-websocket": "^4.4.0",
"sharedb": "^3.2.4",
"sharedb-client-browser": "^4.2.0",
"ws": "^8.12.1"
},
"devDependencies": {
Expand Down

0 comments on commit 0f4b211

Please sign in to comment.