npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

tk-room-ui-sdk

v1.0.9

Published

SDK for RoomUI

Downloads

162

Readme

拓课UISDK说明文档

前言

本文档面对对象为对JavaScript有一定开发经验的前端开发者

立即使用

1. npm的方式

npm install tk-room-ui-sdk
import TKRoom from "tk-room-ui-sdk";

api

本部分中从初始化->进入教室->课中处理逻辑->回调数据的顺序从上往下进行对所有接口进行说明. 所有方法都是基于TKRoomUISDK开始。room可存在多实例。

实例化room对象new TKRoom(options) 

const option = {
  warpDom: document.getElementById('domId') // 容器dom节点
}
const tkRoom = new TKRoom(option)

加入房间TKRoom.prototype.joinRoom(option)

通过配置参数加入房间, 其中角色说明详细请参考《角色说明文档.md》 仅代表加载教室资源成功,房间连接成功需要监听RoomConnection事件

 const joinRoomOptions = {
  serial?: string, // 教室号 (serial和thirdRoomId二者必传一个)
  thirdRoomId?: string; //第三方教室号(serial和thirdRoomId二者必传一个)
  domain?: string; // 企业域名(当使用thridRoomId时,此字段必传)
  userId?: string, // 用户id 非必传
  nickname: string, // 用户昵称 必传
  userRole: number, // 用户角色 必传
  password?: string, // 教室密码 非必传
  norecord?: boolean, // 回放中是否不录自己的音视频 非必传 默认false 
  classBeginLeave?: boolean, // 下课后是销毁还是到结束页面 非必传 默认 false
}

tkRoom.joinRoom(joinRoomOptions).then(res => {
  // 成功
  console.log(res) // {status: 0}
}).catch(err => {
  // 根据状态码非0
  console.log(err) // {status: 1, msg: '错误描述信息'}
})

通过配置webapi创建的进入教室链接,链接生成方式请参考进入房间接口说明

tkRoom.joinRoom(joinRoomOptions).then(res => {
  // 成功
  console.log(res) // {status: 0}
}).catch(err => {
  // 根据状态码非0
  console.log(err) // {status: 1, msg: '错误描述信息'}
})

加入回放教室 TKRoom.prototype.joinPlaybackRoom

 tkRoom.joinPlaybackRoom({
    serial?: string; // 教室号(serial和thirdRoomId二者必传一个)
    thirdRoomId?: string; // 第三方教室号(serial和thirdRoomId二者必传一个)
    domain?: string; // 企业域名(当使用thridRoomId时,此字段必传)
    recordTitle: string; // 录制件title 必传
    lang?: "zh-cn" | "zh-tw" | "en-us"; // 国际化 非必传
}).then(res => {
  
})

离开房间TKRoom.prototype.leaveRoom()

tkRoom.leaveRoom().then(() => {
  console.log('离开房间成功')
}).catch(err=> {
  console.log('离开房间失败', err) // {status: 1, msg: ''}
}) 

销毁房间**TKRoom.prototype.destroy()

tkRoom.destroy()

单独设备检测模块 TKRoom.prototype.joinDeviceCheck()

事件监听 TKRoom.prototype.on(eventName, fn)

具体事件,请参考《教室事件说明文档.md》,这里只提供on方法的用法。

const eventName = TKRoom.EVENTTYPE.XXX // 所有事件说明参考事件说明文档

const fn = (...args) => {
  console.error(args)
}

tkRoom.on(eventName, fn)
  1. 取消事件监听 TKRoom.prototype.off(eventName, function)

其中

const fn = (...args) => {
  console.error(args)
}

tkRoom.on(eventName, fn)

// 取消监听
tkRoom.off(eventName, fn)