JSPM

@netless/slide

0.2.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 99
  • Score
    100M100P100Q93365F
  • License ISC

> TODO: description

Package Exports

  • @netless/slide
  • @netless/slide/lib/Slide.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@netless/slide) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@netless/slide

基本使用

import { Slide } from "@netless/slide";

// 初始化
// 初始化可以传入可选的 renderOptions, 参考 d.ts 类型定义
const slide = new Slide({
    anchor: document.getElementById("root"),
    interactive: true,
});

// 设置资源
slide.setResource(`id`, "url-prefix");

// 显示 ppt, 页码从 1 开始
slide.renderSlide(1);

增量同步

import { Slide, SLIDE_EVENTS } from "@netless/slide";

// 客户端 A
slide.on(SLIDE_EVENTS.syncDispatch, (args: any) => {
    // args 为同步事件参数
    // 将 args 序列化后传递到 客户端 B
});

// 客户端 B
// args 为客户端 A 的同步事件参数
slide.emit(SLIDE_EVENTS.syncReceive, args);

整体同步

// 客户端 A
// 获取 Slide 应用状态
const args = slide.slideState;

// 客户端 B
// 设置 Slide 应用状态
slide.setSlideState(args);

运行状态

Slide 对象上暴露了一系列只读属性, 可以获取当前运行状态, 参考 d.ts 类型定义文件.

changelog