Skip to content

SDK 1.2.1 Getting Started ​

This version is no longer updated

SDK 1.2.1 no longer receives feature updates or maintenance.

SDK 1.2.1 Documentation ​

  • Getting Started: installation, basic usage, configuration, and error handling
  • API Reference: the AlgeoSdk class, methods, and events
  • Protocol Reference: communication protocol, status definitions, and error codes
  • Examples: example source code and local preview instructions

This guide explains how to embed the Dino-GSP geometry canvas in your web application via the SDK. It applies to teaching systems, online question banks, educational apps, and other scenarios that require geometry interactivity.

Installation ​

npm ​

bash
npm install @dajiaoai/algeo-sdk@1.2.1

Basic Usage ​

Option 1: SDK ​

javascript
import { AlgeoSdk } from '@dajiaoai/algeo-sdk';

const container = document.getElementById('algeo-container');
const sdk = await AlgeoSdk.create(container, {
  initialId: '33TA3484', // optional: initial share ID to load
});

// Call methods
sdk.loadShareById('33TA3484').then(() => console.log('Loaded'));
sdk.getSlideCount().then(({ count }) => console.log('Slide count:', count));
sdk.switchSlide(2).then(() => console.log('Switched slide'));

// Destroy
// sdk.destroy();

Option 2: Direct iframe ​

No SDK required. Specify the share ID directly in the iframe src:

html
<iframe
  id="algeo-embed"
  src="https://dajiaoai.com/e/33TA3484"
  allow="fullscreen"
></iframe>

For dynamic loading, slide switching, and other capabilities, use Option 1 (SDK).

Configuration Options ​

PropertyTypeDefaultDescription
initialIdstring''Initial share ID to load; empty for a blank canvas

Error Handling ​

All async methods reject with AlgeoSdkError on failure:

javascript
try {
  await sdk.loadShareById('invalid');
} catch (e) {
  if (e.name === 'AlgeoSdkError') {
    console.error(e.code, e.message, e.details);
  }
}

Common error codes: EMBED_IFRAME_NOT_READY, EMBED_TIMEOUT, EMBED_LOAD_SHARE_FAILED. See Protocol Reference for the full list.

More Examples ​

The SDK package includes an examples directory with the source code. Run npx serve . in the packages/algeo-sdk directory to try them locally.