Get started with yorkie-js-sdk CDN

Apache-2.0 licensed

The Yorkie JS SDK is a library for real-time collaboration on HTML documents.

Tags:
  • crdt
  • realtime-collaboration
  • grpc-web
  • yorkie
  • collaborative-applications
  • yorkie-js-sdk

Stable version

Copied!

How to start using yorkie-js-sdk CDN


<!DOCTYPE html>
<html>
<head>
  <title>Get started with yorkie-js-sdk CDN - cdnhub.io</title>
  <script src="https://cdn.cdnhub.io/yorkie-js-sdk/0.4.15/yorkie-js-sdk.js"></script>
</head>
<body>
  <button id="sync-btn">Sync Data</button>
  <script>
    const client = new Yorkie.Client('my-database', { sync: true });

    document.getElementById('sync-btn').addEventListener('click', () => {
      client.sync()
        .then(() => console.log('Data synced'))
        .catch((err) => console.error('Error syncing data:', err));
    });

    // Initialize the database with some data
    client.set('name', 'John Doe')
      .then(() => client.set('age', 30))
      .then(() => console.log('Data initialized'))
      .catch((err) => console.error('Error initializing data:', err));
  </script>
</body>
</html>
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!

All versions