jjb-h5-supervision-sdk 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +19 -0
- package/README.md +27 -0
- package/dist/index.js +1 -0
- package/dist/index.js.LICENSE.txt +18 -0
- package/package.json +1 -0
- package/types/index.d.ts +141 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
2
|
+
|
|
3
|
+
/** @preserve
|
|
4
|
+
* Counter block mode compatible with Dr Brian Gladman fileenc.c
|
|
5
|
+
* derived from CryptoJS.mode.CTR
|
|
6
|
+
* Jan Hruby jhruby.web@gmail.com
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/** @preserve
|
|
10
|
+
(c) 2012 by Cédric Mesnil. All rights reserved.
|
|
11
|
+
|
|
12
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
13
|
+
|
|
14
|
+
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
15
|
+
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
16
|
+
|
|
17
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
18
|
+
*/
|
package/package.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"name":"jjb-h5-supervision-sdk","version":"0.0.1","description":"点播/直播课程学习监管SDK","main":"dist/index.js","author":"1042656836@qq.com | jiaoxiwei","license":"MIT","typings":"types/index.d.ts","dependencies":{"crypto-js":"^4.1.1"}}
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
// Modify-date 2026/01/01
|
|
2
|
+
|
|
3
|
+
export = JJB_H5_SUPERVISION_SDK;
|
|
4
|
+
export as namespace JJB_H5_SUPERVISION_SDK;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @description 在线测评监听器
|
|
8
|
+
*/
|
|
9
|
+
class ExamObserve {
|
|
10
|
+
private _currentTime: number;
|
|
11
|
+
private _currentTimeCallback: () => void;
|
|
12
|
+
|
|
13
|
+
constructor();
|
|
14
|
+
|
|
15
|
+
get currentTime(): number;
|
|
16
|
+
set currentTime(value: number);
|
|
17
|
+
|
|
18
|
+
pause(): void;
|
|
19
|
+
|
|
20
|
+
addEventListener(type: 'timeupdate', callback: () => void): void;
|
|
21
|
+
|
|
22
|
+
removeEventListener(type: 'timeupdate'): void;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
interface InitOption {
|
|
26
|
+
// 是否开启日志输出
|
|
27
|
+
log?: boolean;
|
|
28
|
+
// 接口网关地址
|
|
29
|
+
host: string;
|
|
30
|
+
// 播放器-原生媒体元素,或以原生媒体元素开发的第三方插件 | 测评监听模拟器
|
|
31
|
+
player?: HTMLMediaElement | ExamObserve;
|
|
32
|
+
|
|
33
|
+
// 控制
|
|
34
|
+
readonly controls?: {
|
|
35
|
+
// 禁用断开提示,默认true
|
|
36
|
+
disabledDisconnectTip: boolean;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @description 初始化监听配置
|
|
41
|
+
* @doc http://opendoc.jjbedu.cn/index.html#init:listener
|
|
42
|
+
*/
|
|
43
|
+
readonly listener?: {
|
|
44
|
+
// 监听-可选配置项-首次验证结束
|
|
45
|
+
onFirstValidateEnd (e: Event): void;
|
|
46
|
+
// 监听-可选配置项-首次验证开始
|
|
47
|
+
onFirstValidateStart (e: Event): void;
|
|
48
|
+
// 监听-可选配置项-SDK已销毁
|
|
49
|
+
onDestroyedHandler (e: Event): void;
|
|
50
|
+
// 监听-可选配置项-SDK连接服务器-成功
|
|
51
|
+
onConnectHandler (e: Event): void;
|
|
52
|
+
// 监听-可选配置项-SDK连接服务器-错误
|
|
53
|
+
onConnectErrorHandler (e: Event): void;
|
|
54
|
+
// 监听-可选配置项-SDK与服务器-断开连接
|
|
55
|
+
onDisconnectHandler (e: Event): void;
|
|
56
|
+
// 监听-可选配置项-SDK数据响应拦截器,包含socket和xhr响应数据
|
|
57
|
+
onResponseIntercept (res: { data: Record<string, any>, method?: string, response?: Record<string, any>, type: 'xhr' | 'socket', url?: string }): void;
|
|
58
|
+
// 监听-可选配置项-SDK断开重启,disabledDisconnectTip属性为true有效
|
|
59
|
+
onRestart (data: { lastSeconds: number }): void;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* @description 初始化基本字段
|
|
64
|
+
* @doc http://opendoc.jjbedu.cn/index.html#studyInfos
|
|
65
|
+
*/
|
|
66
|
+
readonly studyInfos: {
|
|
67
|
+
readonly app_key: string;
|
|
68
|
+
readonly train_type_enum: 'SEND_JXJY' | 'SEND_GQPX';
|
|
69
|
+
readonly course_type_enum: 'DEMAND' | 'LIVE';
|
|
70
|
+
readonly credit_status_enum: 'TRUE' | 'FALSE';
|
|
71
|
+
readonly [ p: string ]: string;
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* @description 运行过程中的验证生命周期类型
|
|
77
|
+
* @doc http://opendoc.jjbedu.cn/index.html#Context
|
|
78
|
+
*/
|
|
79
|
+
interface MessageType {
|
|
80
|
+
// SDK-已准备
|
|
81
|
+
IS_READY: string;
|
|
82
|
+
// SDK-学习完成
|
|
83
|
+
IS_COMPLETE: string;
|
|
84
|
+
// SDK-验证规则激活
|
|
85
|
+
VERIFY_LIFE_CYCLE_RULE_ACTIVE: string;
|
|
86
|
+
// SDK-验证规则进入
|
|
87
|
+
VERIFY_LIFE_CYCLE_RULE_ENTER: string;
|
|
88
|
+
// SDK-验证规则开始
|
|
89
|
+
VERIFY_LIFE_CYCLE_RULE_START: string;
|
|
90
|
+
// SDK-验证规则结束
|
|
91
|
+
VERIFY_LIFE_CYCLE_RULE_END: string;
|
|
92
|
+
// SDK-验证规则退出
|
|
93
|
+
VERIFY_LIFE_CYCLE_RULE_EXIT: string;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* @description SDK初始化实例对象
|
|
98
|
+
* @doc http://opendoc.jjbedu.cn/index.html#Context
|
|
99
|
+
*/
|
|
100
|
+
interface InitInstance {
|
|
101
|
+
/**
|
|
102
|
+
* 是否需要弹出验证 true | false
|
|
103
|
+
*/
|
|
104
|
+
popupStatus: boolean;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* @description 监听消息
|
|
108
|
+
* @param callback
|
|
109
|
+
*/
|
|
110
|
+
onMessage: (res: { type: string, lastSeconds: number, sections: {}[], report: boolean }) => void;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* @description SDK内置API
|
|
115
|
+
* @doc http://opendoc.jjbedu.cn/index.html#API
|
|
116
|
+
*/
|
|
117
|
+
declare namespace JJB_H5_SUPERVISION_SDK {
|
|
118
|
+
/**
|
|
119
|
+
* @description 初始化SDK
|
|
120
|
+
* @param option 初始化配置项
|
|
121
|
+
* @param getContext 初始化成功的上下文回调
|
|
122
|
+
* @doc https://opendoc.jjbedu.cn/index.html
|
|
123
|
+
*/
|
|
124
|
+
function init (option: InitOption, getContext?: (context: InitInstance) => void): void;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* @description 检查SDK运行状态
|
|
128
|
+
*/
|
|
129
|
+
function check (): boolean;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* @description 打印版本号
|
|
133
|
+
*/
|
|
134
|
+
function version (): string;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* @description 手动销毁SDK
|
|
138
|
+
* @param callback 销毁完成回调
|
|
139
|
+
*/
|
|
140
|
+
function destroy (callback?: () => void): void;
|
|
141
|
+
}
|