@realsee/live 0.3.0-alpha.3 → 0.4.0-alpha.2
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/dist/index.d.ts +4 -0
- package/dist/live/controller.d.ts +43 -0
- package/{lib → dist/live}/createLive.d.ts +6 -6
- package/dist/live/createLiveReact.d.ts +6 -0
- package/dist/realsee-live.cjs.development.js +4630 -0
- package/dist/realsee-live.cjs.development.js.map +1 -0
- package/dist/realsee-live.cjs.js +7 -0
- package/dist/realsee-live.cjs.production.js +2 -0
- package/dist/realsee-live.cjs.production.js.map +1 -0
- package/dist/realsee-live.esm.js +4615 -0
- package/dist/realsee-live.esm.js.map +1 -0
- package/dist/realsee-live.umd.development.js +52454 -0
- package/dist/realsee-live.umd.development.js.map +1 -0
- package/dist/realsee-live.umd.production.js +2 -0
- package/dist/realsee-live.umd.production.js.map +1 -0
- package/{lib/RTC → dist/rtc}/BrowserRTC.d.ts +29 -30
- package/{lib/RTC → dist/rtc}/BrowserRTC4Chime.d.ts +55 -53
- package/dist/rtc/CoreRTC.d.ts +23 -0
- package/{lib/RTC → dist/rtc}/VRWebViewRTC.d.ts +22 -23
- package/dist/rtc/index.d.ts +5 -0
- package/{lib/typings/Chime → dist/typings/chime}/AttendeeResponse.d.ts +5 -5
- package/{lib/typings/Chime → dist/typings/chime}/MeetingResponse.d.ts +12 -12
- package/{lib/typings/Chime → dist/typings/chime}/MeetingSessionConfigurationOptions.d.ts +16 -16
- package/dist/typings/chime/index.d.ts +3 -0
- package/dist/typings/index.d.ts +4 -0
- package/{lib/typings → dist/typings/live}/EventType.d.ts +90 -89
- package/{lib/typings → dist/typings/live}/GetVoiceSign.d.ts +17 -11
- package/{lib/typings → dist/typings/live}/Live.d.ts +123 -122
- package/{lib/typings → dist/typings/live}/LiveMsg.d.ts +119 -119
- package/{lib/typings → dist/typings/live}/LiveOptions.d.ts +65 -46
- package/{lib/typings → dist/typings/live}/RoomInfo.d.ts +13 -13
- package/{lib/typings → dist/typings/live}/UserInfo.d.ts +87 -87
- package/dist/typings/live/UserVolume.d.ts +7 -0
- package/{lib/typings → dist/typings/live}/WebSocket.d.ts +78 -78
- package/dist/typings/live/index.d.ts +9 -0
- package/{lib/createLiveReact.d.ts → dist/typings/react/LiveReact.d.ts} +162 -160
- package/dist/typings/react/RTCActionReactCallback.d.ts +2 -0
- package/dist/typings/react/index.d.ts +2 -0
- package/dist/typings/rtc/VRWebViewRTCOptions.d.ts +6 -0
- package/{lib/typings/RTCEventType.d.ts → dist/typings/rtc/eventType.d.ts} +29 -35
- package/dist/typings/rtc/index.d.ts +5 -0
- package/{lib/typings/RTCJoinedInfo.d.ts → dist/typings/rtc/joinedInfo.d.ts} +34 -28
- package/{lib/typings/RTCProtocol.d.ts → dist/typings/rtc/protocol.d.ts} +53 -42
- package/dist/typings/rtc/type.d.ts +8 -0
- package/{lib/shared-utils → dist/utils}/appendUri.d.ts +1 -1
- package/dist/utils/clientDetector.d.ts +4 -0
- package/{lib/shared-utils → dist/utils}/equal.d.ts +10 -11
- package/{lib/shared-utils/Subscribe.d.ts → dist/utils/subscribe.d.ts} +75 -76
- package/{lib/shared-utils → dist/utils}/uuid.d.ts +4 -4
- package/package.json +22 -34
- package/docs/.nojekyll +0 -1
- package/docs/assets/custom.css +0 -43
- package/docs/assets/highlight.css +0 -127
- package/docs/assets/icons.css +0 -1043
- package/docs/assets/icons.png +0 -0
- package/docs/assets/icons@2x.png +0 -0
- package/docs/assets/main.js +0 -52
- package/docs/assets/search.js +0 -1
- package/docs/assets/style.css +0 -1413
- package/docs/assets/widgets.png +0 -0
- package/docs/assets/widgets@2x.png +0 -0
- package/docs/classes/RTCProtocol.BrowserRTC.html +0 -60
- package/docs/classes/RTCProtocol.BrowserRTC4Chime.html +0 -66
- package/docs/classes/RTCProtocol.RTCExample.html +0 -62
- package/docs/classes/RTCProtocol.VRWebViewRTC.html +0 -60
- package/docs/classes/shared_utils.Subscribe.html +0 -56
- package/docs/enums/RTCProtocol.RTCJoinedInfoCodeEnum.html +0 -9
- package/docs/enums/RTCProtocol.RTCType.html +0 -1
- package/docs/enums/live.BuiltinActionType.html +0 -15
- package/docs/enums/live.BuiltinEventType.html +0 -7
- package/docs/enums/live.Command.html +0 -7
- package/docs/enums/live.MemUserStatus.html +0 -1
- package/docs/enums/live.MicroStatus.html +0 -3
- package/docs/enums/live.UserStatus.html +0 -9
- package/docs/enums/live.WebSocketCloseError.html +0 -19
- package/docs/enums/live.WebSocketErrorType.html +0 -1
- package/docs/enums/live.WebSocketState.html +0 -13
- package/docs/index.html +0 -382
- package/docs/interfaces/RTCProtocol.GetVoiceSignReturnType.html +0 -1
- package/docs/interfaces/RTCProtocol.RTCJoinedInfo.html +0 -1
- package/docs/interfaces/RTCProtocol.RTCProtocol-1.html +0 -60
- package/docs/interfaces/RTCProtocol.VRWebViewRTCOptions.html +0 -1
- package/docs/interfaces/live.Live.html +0 -119
- package/docs/interfaces/live.LiveOptions.html +0 -22
- package/docs/interfaces/live.LiveReact.html +0 -52
- package/docs/modules/RTCProtocol.html +0 -17
- package/docs/modules/live.html +0 -103
- package/docs/modules/shared_utils.html +0 -10
- package/docs/modules.html +0 -1
- package/lib/RTC/BrowserRTC.js +0 -169
- package/lib/RTC/BrowserRTC.js.map +0 -1
- package/lib/RTC/BrowserRTC4Chime.js +0 -299
- package/lib/RTC/BrowserRTC4Chime.js.map +0 -1
- package/lib/RTC/VRWebViewRTC.js +0 -125
- package/lib/RTC/VRWebViewRTC.js.map +0 -1
- package/lib/RTC/index.d.ts +0 -22
- package/lib/RTC/index.js +0 -50
- package/lib/RTC/index.js.map +0 -1
- package/lib/createLive.js +0 -590
- package/lib/createLive.js.map +0 -1
- package/lib/createLiveReact.js +0 -212
- package/lib/createLiveReact.js.map +0 -1
- package/lib/index.d.ts +0 -2
- package/lib/index.js +0 -8
- package/lib/index.js.map +0 -1
- package/lib/shared-utils/Subscribe.js +0 -134
- package/lib/shared-utils/Subscribe.js.map +0 -1
- package/lib/shared-utils/appendUri.js +0 -13
- package/lib/shared-utils/appendUri.js.map +0 -1
- package/lib/shared-utils/equal.js +0 -92
- package/lib/shared-utils/equal.js.map +0 -1
- package/lib/shared-utils/uuid.js +0 -17
- package/lib/shared-utils/uuid.js.map +0 -1
- package/lib/typings/Chime/AttendeeResponse.js +0 -3
- package/lib/typings/Chime/AttendeeResponse.js.map +0 -1
- package/lib/typings/Chime/MeetingResponse.js +0 -3
- package/lib/typings/Chime/MeetingResponse.js.map +0 -1
- package/lib/typings/Chime/MeetingSessionConfigurationOptions.js +0 -3
- package/lib/typings/Chime/MeetingSessionConfigurationOptions.js.map +0 -1
- package/lib/typings/EventType.js +0 -3
- package/lib/typings/EventType.js.map +0 -1
- package/lib/typings/GetVoiceSign.js +0 -3
- package/lib/typings/GetVoiceSign.js.map +0 -1
- package/lib/typings/Live.js +0 -3
- package/lib/typings/Live.js.map +0 -1
- package/lib/typings/LiveMsg.js +0 -111
- package/lib/typings/LiveMsg.js.map +0 -1
- package/lib/typings/LiveOptions.js +0 -3
- package/lib/typings/LiveOptions.js.map +0 -1
- package/lib/typings/RTCEventType.js +0 -3
- package/lib/typings/RTCEventType.js.map +0 -1
- package/lib/typings/RTCJoinedInfo.js +0 -23
- package/lib/typings/RTCJoinedInfo.js.map +0 -1
- package/lib/typings/RTCProtocol.js +0 -9
- package/lib/typings/RTCProtocol.js.map +0 -1
- package/lib/typings/RoomInfo.js +0 -3
- package/lib/typings/RoomInfo.js.map +0 -1
- package/lib/typings/UserInfo.js +0 -31
- package/lib/typings/UserInfo.js.map +0 -1
- package/lib/typings/VRWebViewRTCOptions.d.ts +0 -6
- package/lib/typings/VRWebViewRTCOptions.js +0 -3
- package/lib/typings/VRWebViewRTCOptions.js.map +0 -1
- package/lib/typings/WebSocket.js +0 -107
- package/lib/typings/WebSocket.js.map +0 -1
- package/umd/RTCProtocol.543610f0.js +0 -1
- package/umd/createLive.96395a4c.js +0 -1
- package/umd/createLiveReact.e1836101.js +0 -1
package/lib/RTC/index.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RTCExample = void 0;
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
5
|
-
var Subscribe_1 = require("../shared-utils/Subscribe");
|
|
6
|
-
var RTCProtocol_1 = require("../typings/RTCProtocol");
|
|
7
|
-
/**
|
|
8
|
-
* RTCExample。
|
|
9
|
-
*/
|
|
10
|
-
var RTCExample = /** @class */ (function (_super) {
|
|
11
|
-
tslib_1.__extends(RTCExample, _super);
|
|
12
|
-
function RTCExample() {
|
|
13
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
14
|
-
_this.joined = false;
|
|
15
|
-
_this.micro = false;
|
|
16
|
-
_this.voiceId = '';
|
|
17
|
-
_this.type = RTCProtocol_1.RTCType.realsee;
|
|
18
|
-
return _this;
|
|
19
|
-
}
|
|
20
|
-
RTCExample.prototype.join = function (options) {
|
|
21
|
-
throw new Error('Method not implemented.');
|
|
22
|
-
};
|
|
23
|
-
RTCExample.prototype.quit = function () {
|
|
24
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
25
|
-
return tslib_1.__generator(this, function (_a) {
|
|
26
|
-
return [2 /*return*/, true];
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
};
|
|
30
|
-
RTCExample.prototype.detectMicro = function () {
|
|
31
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
32
|
-
return tslib_1.__generator(this, function (_a) {
|
|
33
|
-
return [2 /*return*/, true];
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
};
|
|
37
|
-
RTCExample.prototype.toggleMicro = function (flag) {
|
|
38
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
39
|
-
return tslib_1.__generator(this, function (_a) {
|
|
40
|
-
return [2 /*return*/, true];
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
RTCExample.prototype.shock = function () {
|
|
45
|
-
// throw new Error('Method not implemented.')
|
|
46
|
-
};
|
|
47
|
-
return RTCExample;
|
|
48
|
-
}(Subscribe_1.Subscribe));
|
|
49
|
-
exports.RTCExample = RTCExample;
|
|
50
|
-
//# sourceMappingURL=index.js.map
|
package/lib/RTC/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../resources/RTC/index.ts"],"names":[],"mappings":";;;;AACA,uDAAqD;AACrD,sDAA6D;AAG7D;;GAEG;AACH;IAAgC,sCAAuB;IAAvD;QAAA,qEAsBC;QAlBC,YAAM,GAAY,KAAK,CAAA;QACvB,WAAK,GAAY,KAAK,CAAA;QACtB,aAAO,GAAW,EAAE,CAAA;QACpB,UAAI,GAAY,qBAAO,CAAC,OAAO,CAAA;;IAejC,CAAC;IArBC,yBAAI,GAAJ,UAAK,OAAoF;QACvF,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAA;IAC5C,CAAC;IAOK,yBAAI,GAAV;;;gBACE,sBAAO,IAAI,EAAA;;;KACZ;IACK,gCAAW,GAAjB;;;gBACE,sBAAO,IAAI,EAAA;;;KACZ;IACK,gCAAW,GAAjB,UAAkB,IAAc;;;gBAC9B,sBAAO,IAAI,EAAA;;;KACZ;IACD,0BAAK,GAAL;QACE,6CAA6C;IAC/C,CAAC;IACH,iBAAC;AAAD,CAAC,AAtBD,CAAgC,qBAAS,GAsBxC;AAtBY,gCAAU"}
|
package/lib/createLive.js
DELETED
|
@@ -1,590 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createLive = void 0;
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
5
|
-
var uuid_1 = require("./shared-utils/uuid");
|
|
6
|
-
var equal_1 = require("./shared-utils/equal");
|
|
7
|
-
var appendUri_1 = require("./shared-utils/appendUri");
|
|
8
|
-
var Subscribe_1 = require("./shared-utils/Subscribe");
|
|
9
|
-
var WebSocket_1 = require("./typings/WebSocket");
|
|
10
|
-
var LiveMsg_1 = require("./typings/LiveMsg");
|
|
11
|
-
var RTC_1 = require("./RTC");
|
|
12
|
-
var LiveController = /** @class */ (function () {
|
|
13
|
-
function LiveController(options) {
|
|
14
|
-
var _this = this;
|
|
15
|
-
this.readyState = WebSocket_1.WebSocketState.NOTINITIALIZED;
|
|
16
|
-
this.canSync = true;
|
|
17
|
-
this.connecting = false;
|
|
18
|
-
this.keyframes = {};
|
|
19
|
-
/**
|
|
20
|
-
* 检测 WebSocket.readyState 状态
|
|
21
|
-
*/
|
|
22
|
-
this.checkReadyState = function (live) {
|
|
23
|
-
do {
|
|
24
|
-
if (!_this.webSocket) {
|
|
25
|
-
if (_this.readyState !== WebSocket_1.WebSocketState.NOTINITIALIZED) {
|
|
26
|
-
_this.readyState = WebSocket_1.WebSocketState.NOTINITIALIZED;
|
|
27
|
-
live.emit('ws.readyStateUpdate', _this.readyState);
|
|
28
|
-
}
|
|
29
|
-
break;
|
|
30
|
-
}
|
|
31
|
-
var readyState = _this.webSocket.readyState;
|
|
32
|
-
if (readyState !== _this.readyState) {
|
|
33
|
-
_this.readyState = readyState;
|
|
34
|
-
live.emit('ws.readyStateUpdate', _this.readyState);
|
|
35
|
-
}
|
|
36
|
-
} while (false);
|
|
37
|
-
return _this.readyState;
|
|
38
|
-
};
|
|
39
|
-
this.dispose = function () {
|
|
40
|
-
console.log('dispose');
|
|
41
|
-
_this.disposeWebSocket();
|
|
42
|
-
_this.connecting = false;
|
|
43
|
-
if (_this.healthCheckId) {
|
|
44
|
-
clearInterval(_this.healthCheckId);
|
|
45
|
-
_this.healthCheckId = undefined;
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
/**
|
|
49
|
-
* 销毁WebSocket相关依赖。
|
|
50
|
-
*/
|
|
51
|
-
this.disposeWebSocket = function () {
|
|
52
|
-
if (!_this.webSocket)
|
|
53
|
-
return;
|
|
54
|
-
if (_this.onEvtOpnListener) {
|
|
55
|
-
_this.webSocket.removeEventListener('open', _this.onEvtOpnListener);
|
|
56
|
-
_this.onEvtOpnListener = undefined;
|
|
57
|
-
}
|
|
58
|
-
if (_this.onEvtMsgListener) {
|
|
59
|
-
_this.webSocket.removeEventListener('message', _this.onEvtMsgListener);
|
|
60
|
-
_this.onEvtMsgListener = undefined;
|
|
61
|
-
}
|
|
62
|
-
if (_this.onEvtErrListener) {
|
|
63
|
-
_this.webSocket.removeEventListener('error', _this.onEvtErrListener);
|
|
64
|
-
_this.onEvtErrListener = undefined;
|
|
65
|
-
}
|
|
66
|
-
if (_this.onEvtCLEListener) {
|
|
67
|
-
_this.webSocket.removeEventListener('close', _this.onEvtCLEListener);
|
|
68
|
-
_this.onEvtCLEListener = undefined;
|
|
69
|
-
}
|
|
70
|
-
_this.webSocket.close();
|
|
71
|
-
_this.webSocket = undefined;
|
|
72
|
-
};
|
|
73
|
-
this.options = Object.assign({ autoConnect: true, healthCheck: 3000 }, options);
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* 解析数据
|
|
77
|
-
* @param msgInfo
|
|
78
|
-
* @param live
|
|
79
|
-
*/
|
|
80
|
-
LiveController.prototype.handleMessage = function (liveMsg, live) {
|
|
81
|
-
var _this = this;
|
|
82
|
-
var _a, _b, _c;
|
|
83
|
-
var command = liveMsg.command, data = liveMsg.data, frontRequestId = liveMsg.frontRequestId, code = liveMsg.code, message = liveMsg.message;
|
|
84
|
-
if (code !== 'SUCCESS') {
|
|
85
|
-
return live.emit('error', liveMsg);
|
|
86
|
-
}
|
|
87
|
-
switch (command) {
|
|
88
|
-
case LiveMsg_1.Command.SelfUserInfo: {
|
|
89
|
-
var selfInfo = data;
|
|
90
|
-
if ((0, equal_1.equal)(this.selfUserInfo, selfInfo, { deep: true }))
|
|
91
|
-
return;
|
|
92
|
-
this.selfUserInfo = selfInfo;
|
|
93
|
-
live.emit('selfInfoUpdate', this.selfUserInfo, frontRequestId);
|
|
94
|
-
break;
|
|
95
|
-
}
|
|
96
|
-
case LiveMsg_1.Command.RoomInfo: {
|
|
97
|
-
var roomInfo = data;
|
|
98
|
-
this.roomInfo = Object.assign({}, roomInfo);
|
|
99
|
-
live.emit('readyKeyframeSync', (roomInfo.last_frame || {}));
|
|
100
|
-
break;
|
|
101
|
-
}
|
|
102
|
-
case LiveMsg_1.Command.RTCInfo: {
|
|
103
|
-
var _d = data, voiceId = _d.voice_id, type = _d.type;
|
|
104
|
-
/* 如果已经进入语音房间,则不重复进入 --> "RTCInfo" 指令可能会下发多次 */
|
|
105
|
-
if (live.$RTC.joined) {
|
|
106
|
-
break;
|
|
107
|
-
}
|
|
108
|
-
live.$RTC.join({
|
|
109
|
-
voiceId: voiceId,
|
|
110
|
-
userId: ((_a = this.selfUserInfo) === null || _a === void 0 ? void 0 : _a.id) || "",
|
|
111
|
-
roomId: (_b = this.roomInfo) === null || _b === void 0 ? void 0 : _b.info.room_code,
|
|
112
|
-
type: type,
|
|
113
|
-
});
|
|
114
|
-
// 加入房间后 麦克风默认就开启了:需要发个指令。
|
|
115
|
-
live.updateStatus(LiveMsg_1.BuiltinEventType.UserChange, LiveMsg_1.BuiltinActionType.UserMicroStatus, {
|
|
116
|
-
status: LiveMsg_1.MicroStatus.OPEN
|
|
117
|
-
});
|
|
118
|
-
break;
|
|
119
|
-
}
|
|
120
|
-
case LiveMsg_1.Command.UserList: {
|
|
121
|
-
var userList = data;
|
|
122
|
-
this.userList = userList;
|
|
123
|
-
live.emit('userListUpdate', this.userList, frontRequestId);
|
|
124
|
-
break;
|
|
125
|
-
}
|
|
126
|
-
case LiveMsg_1.Command.CustomEvent: {
|
|
127
|
-
var evtMsg = data;
|
|
128
|
-
live.emit('broadcast', evtMsg, frontRequestId);
|
|
129
|
-
break;
|
|
130
|
-
}
|
|
131
|
-
case LiveMsg_1.Command.KeyframeSync: {
|
|
132
|
-
var remoteKeyframes_1 = data;
|
|
133
|
-
// 此处做一层 diff,仅跟本地数据不一致的情况下才广播数据。
|
|
134
|
-
var keyframes = Object.keys(remoteKeyframes_1)
|
|
135
|
-
.reduce(function (accu, curr) {
|
|
136
|
-
var _a;
|
|
137
|
-
if ((0, equal_1.equal)(remoteKeyframes_1[curr], _this.keyframes[curr], { deep: true })) {
|
|
138
|
-
return accu;
|
|
139
|
-
}
|
|
140
|
-
var params = [remoteKeyframes_1[curr], _this.keyframes[curr], frontRequestId];
|
|
141
|
-
var evtName = curr;
|
|
142
|
-
(_a = live.keyframes).emit.apply(_a, tslib_1.__spreadArray([evtName], params, false));
|
|
143
|
-
_this.keyframes[curr] = remoteKeyframes_1[curr];
|
|
144
|
-
accu[curr] = remoteKeyframes_1[curr];
|
|
145
|
-
return accu;
|
|
146
|
-
}, {});
|
|
147
|
-
live.emit('keyframes', keyframes, frontRequestId);
|
|
148
|
-
break;
|
|
149
|
-
}
|
|
150
|
-
case LiveMsg_1.Command.BuiltinMsg: {
|
|
151
|
-
var builtinMsg = data;
|
|
152
|
-
live.emit('builtinEvent', builtinMsg);
|
|
153
|
-
if (builtinMsg.event_type === LiveMsg_1.BuiltinEventType.UserChange) {
|
|
154
|
-
live.emit('userChange', builtinMsg);
|
|
155
|
-
}
|
|
156
|
-
if (builtinMsg.event_type === LiveMsg_1.BuiltinEventType.RoomChange) {
|
|
157
|
-
live.emit('roomChange', builtinMsg);
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* 下发指令自己操作麦克风
|
|
161
|
-
*/
|
|
162
|
-
if (builtinMsg.event_type === LiveMsg_1.BuiltinEventType.UserChange && builtinMsg.action === LiveMsg_1.BuiltinActionType.UserMicroStatus) {
|
|
163
|
-
live.toggleMicro(builtinMsg.data.status === LiveMsg_1.MicroStatus.OPEN);
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* 如果下发指令退出房间,则 关闭麦克风 及 销毁 WebSocket
|
|
167
|
-
*/
|
|
168
|
-
if (builtinMsg.event_type === LiveMsg_1.BuiltinEventType.RoomChange && builtinMsg.action === LiveMsg_1.BuiltinActionType.RoomClose) {
|
|
169
|
-
(_c = this.options.rtc) === null || _c === void 0 ? void 0 : _c.quit();
|
|
170
|
-
this.disposeWebSocket();
|
|
171
|
-
}
|
|
172
|
-
break;
|
|
173
|
-
}
|
|
174
|
-
case LiveMsg_1.Command.UserKickOut: {
|
|
175
|
-
live.emit('kickOut');
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
};
|
|
179
|
-
/**
|
|
180
|
-
* 发送数据
|
|
181
|
-
* @param data
|
|
182
|
-
*/
|
|
183
|
-
LiveController.prototype.sendMessage = function (data) {
|
|
184
|
-
if (!this.webSocket)
|
|
185
|
-
return console.warn('WebSocket has not yet been initialized!');
|
|
186
|
-
if (!data)
|
|
187
|
-
return console.warn('WebSocket messages is empty!');
|
|
188
|
-
this.webSocket.send(JSON.stringify(data));
|
|
189
|
-
};
|
|
190
|
-
return LiveController;
|
|
191
|
-
}());
|
|
192
|
-
/**
|
|
193
|
-
* 创建 `live` 实例。
|
|
194
|
-
*/
|
|
195
|
-
function createLive(options) {
|
|
196
|
-
var liveController = new LiveController(options);
|
|
197
|
-
var createLiveMsg = function (command, data, toUserIds) {
|
|
198
|
-
if (data === void 0) { data = {}; }
|
|
199
|
-
toUserIds = toUserIds ? (Array.isArray(toUserIds) ? toUserIds : [toUserIds]) : [];
|
|
200
|
-
if (toUserIds)
|
|
201
|
-
data['to_user_ids'] = toUserIds;
|
|
202
|
-
return { command: command, front_request_id: (0, uuid_1.uuid)(), data: data };
|
|
203
|
-
};
|
|
204
|
-
var LiveTpl = /** @class */ (function (_super) {
|
|
205
|
-
tslib_1.__extends(LiveTpl, _super);
|
|
206
|
-
function LiveTpl() {
|
|
207
|
-
var _this = _super.call(this) || this;
|
|
208
|
-
_this.keyframes = new Subscribe_1.Subscribe();
|
|
209
|
-
if (!options.rtc) {
|
|
210
|
-
liveController.options.rtc = new RTC_1.RTCExample();
|
|
211
|
-
}
|
|
212
|
-
// 默认自动连接
|
|
213
|
-
if (liveController.options.url && liveController.options.getTicket) {
|
|
214
|
-
_this.connect();
|
|
215
|
-
}
|
|
216
|
-
// 健康检查:WHY --> 在某些WebView特殊场景下 WebSocket.readyState 发生变化时不会出发error\close等事件;
|
|
217
|
-
// 因此,开启一个定时任务监测 WebSocket.readyState 状态的更新
|
|
218
|
-
var healthCheck = (function (healthCheck) {
|
|
219
|
-
if (!healthCheck)
|
|
220
|
-
return 0;
|
|
221
|
-
if (healthCheck === true)
|
|
222
|
-
return 3000;
|
|
223
|
-
var duration = Number(healthCheck);
|
|
224
|
-
if (duration > 0)
|
|
225
|
-
return duration;
|
|
226
|
-
return 3000;
|
|
227
|
-
})(liveController.options.healthCheck);
|
|
228
|
-
if (healthCheck) {
|
|
229
|
-
liveController.healthCheckId = setInterval(function () { return liveController.checkReadyState(_this); }, healthCheck);
|
|
230
|
-
}
|
|
231
|
-
return _this;
|
|
232
|
-
}
|
|
233
|
-
Object.defineProperty(LiveTpl.prototype, "options", {
|
|
234
|
-
get: function () {
|
|
235
|
-
return Object.freeze(Object.assign({}, liveController.options));
|
|
236
|
-
},
|
|
237
|
-
enumerable: false,
|
|
238
|
-
configurable: true
|
|
239
|
-
});
|
|
240
|
-
Object.defineProperty(LiveTpl.prototype, "readyState", {
|
|
241
|
-
get: function () {
|
|
242
|
-
liveController.checkReadyState(this);
|
|
243
|
-
return liveController.readyState;
|
|
244
|
-
},
|
|
245
|
-
enumerable: false,
|
|
246
|
-
configurable: true
|
|
247
|
-
});
|
|
248
|
-
Object.defineProperty(LiveTpl.prototype, "url", {
|
|
249
|
-
get: function () {
|
|
250
|
-
var _a;
|
|
251
|
-
return ((_a = liveController.webSocket) === null || _a === void 0 ? void 0 : _a.url) || '';
|
|
252
|
-
},
|
|
253
|
-
enumerable: false,
|
|
254
|
-
configurable: true
|
|
255
|
-
});
|
|
256
|
-
Object.defineProperty(LiveTpl.prototype, "selfInfo", {
|
|
257
|
-
get: function () {
|
|
258
|
-
return liveController.selfUserInfo;
|
|
259
|
-
},
|
|
260
|
-
enumerable: false,
|
|
261
|
-
configurable: true
|
|
262
|
-
});
|
|
263
|
-
Object.defineProperty(LiveTpl.prototype, "userList", {
|
|
264
|
-
get: function () {
|
|
265
|
-
return liveController.userList || [];
|
|
266
|
-
},
|
|
267
|
-
enumerable: false,
|
|
268
|
-
configurable: true
|
|
269
|
-
});
|
|
270
|
-
Object.defineProperty(LiveTpl.prototype, "snapshot", {
|
|
271
|
-
get: function () {
|
|
272
|
-
return liveController.keyframes || {};
|
|
273
|
-
},
|
|
274
|
-
enumerable: false,
|
|
275
|
-
configurable: true
|
|
276
|
-
});
|
|
277
|
-
Object.defineProperty(LiveTpl.prototype, "$RTC", {
|
|
278
|
-
get: function () {
|
|
279
|
-
return liveController.options.rtc;
|
|
280
|
-
},
|
|
281
|
-
enumerable: false,
|
|
282
|
-
configurable: true
|
|
283
|
-
});
|
|
284
|
-
LiveTpl.prototype.setSelfInfo = function (userInfo) {
|
|
285
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
286
|
-
var error_1;
|
|
287
|
-
return tslib_1.__generator(this, function (_a) {
|
|
288
|
-
switch (_a.label) {
|
|
289
|
-
case 0:
|
|
290
|
-
if (this.readyState !== WebSocket_1.WebSocketState.OPEN) {
|
|
291
|
-
return [2 /*return*/, new Error('The connection is not open and ready to communicate.')];
|
|
292
|
-
}
|
|
293
|
-
_a.label = 1;
|
|
294
|
-
case 1:
|
|
295
|
-
_a.trys.push([1, 3, , 4]);
|
|
296
|
-
return [4 /*yield*/, this.updateStatus(LiveMsg_1.BuiltinEventType.UserChange, LiveMsg_1.BuiltinActionType.UserInfo, userInfo)];
|
|
297
|
-
case 2: return [2 /*return*/, _a.sent()];
|
|
298
|
-
case 3:
|
|
299
|
-
error_1 = _a.sent();
|
|
300
|
-
return [2 /*return*/, error_1];
|
|
301
|
-
case 4: return [2 /*return*/];
|
|
302
|
-
}
|
|
303
|
-
});
|
|
304
|
-
});
|
|
305
|
-
};
|
|
306
|
-
LiveTpl.prototype.getFramesByKey = function (key) {
|
|
307
|
-
return liveController.keyframes[key];
|
|
308
|
-
};
|
|
309
|
-
LiveTpl.prototype.sendKeyframe = function (key, frame) {
|
|
310
|
-
if (this.readyState !== WebSocket_1.WebSocketState.OPEN) {
|
|
311
|
-
return new Error('The connection is not open and ready to communicate.');
|
|
312
|
-
}
|
|
313
|
-
liveController.keyframes[key] = frame;
|
|
314
|
-
var liveMsg = createLiveMsg(LiveMsg_1.Command.KeyframeSync, this.snapshot);
|
|
315
|
-
liveController.sendMessage(liveMsg);
|
|
316
|
-
return true;
|
|
317
|
-
};
|
|
318
|
-
LiveTpl.prototype.broadcast = function (data, toUserIds, timeout) {
|
|
319
|
-
var _this = this;
|
|
320
|
-
if (this.readyState !== WebSocket_1.WebSocketState.OPEN) {
|
|
321
|
-
return new Error('The connection is not open and ready to communicate.');
|
|
322
|
-
}
|
|
323
|
-
return new Promise(function (resolve, reject) {
|
|
324
|
-
var customEvent = createLiveMsg(LiveMsg_1.Command.CustomEvent, data, toUserIds);
|
|
325
|
-
var front_request_id = customEvent.front_request_id;
|
|
326
|
-
liveController.sendMessage(customEvent);
|
|
327
|
-
var timeoutId = timeout ? setTimeout(function () {
|
|
328
|
-
reject(new Error('RESPONSE TIMEOUT'));
|
|
329
|
-
_this.off('broadcast', broadcast);
|
|
330
|
-
}, timeout) : undefined;
|
|
331
|
-
var broadcast = function (data, frontRequestId) {
|
|
332
|
-
if (frontRequestId !== front_request_id)
|
|
333
|
-
return;
|
|
334
|
-
_this.off('broadcast', broadcast);
|
|
335
|
-
resolve(data);
|
|
336
|
-
if (timeoutId)
|
|
337
|
-
clearInterval(timeoutId);
|
|
338
|
-
};
|
|
339
|
-
_this.on('broadcast', broadcast);
|
|
340
|
-
});
|
|
341
|
-
};
|
|
342
|
-
LiveTpl.prototype.updateStatus = function (evtType, atnType, status, toUserIds) {
|
|
343
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
344
|
-
var data, liveMsg;
|
|
345
|
-
return tslib_1.__generator(this, function (_a) {
|
|
346
|
-
if (this.readyState !== WebSocket_1.WebSocketState.OPEN) {
|
|
347
|
-
return [2 /*return*/, false];
|
|
348
|
-
}
|
|
349
|
-
data = Object.assign({ event_type: evtType, action: atnType }, { data: status });
|
|
350
|
-
liveMsg = createLiveMsg(LiveMsg_1.Command.BuiltinMsg, data, toUserIds);
|
|
351
|
-
liveController.sendMessage(liveMsg);
|
|
352
|
-
return [2 /*return*/, true];
|
|
353
|
-
});
|
|
354
|
-
});
|
|
355
|
-
};
|
|
356
|
-
// 仅用于用户自己的麦克风控制
|
|
357
|
-
LiveTpl.prototype.toggleMicro = function (microStatus) {
|
|
358
|
-
var _a, _b;
|
|
359
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
360
|
-
return tslib_1.__generator(this, function (_c) {
|
|
361
|
-
switch (_c.label) {
|
|
362
|
-
case 0:
|
|
363
|
-
if (!((_b = (_a = this.selfInfo) === null || _a === void 0 ? void 0 : _a.permission) === null || _b === void 0 ? void 0 : _b.control_own_micro))
|
|
364
|
-
return [2 /*return*/, false];
|
|
365
|
-
return [4 /*yield*/, this.$RTC.toggleMicro(microStatus)];
|
|
366
|
-
case 1:
|
|
367
|
-
_c.sent();
|
|
368
|
-
return [4 /*yield*/, this.updateStatus(LiveMsg_1.BuiltinEventType.UserChange, LiveMsg_1.BuiltinActionType.UserMicroStatus, {
|
|
369
|
-
status: microStatus ? LiveMsg_1.MicroStatus.OPEN : LiveMsg_1.MicroStatus.CLOSE
|
|
370
|
-
}, [])];
|
|
371
|
-
case 2: return [2 /*return*/, _c.sent()];
|
|
372
|
-
}
|
|
373
|
-
});
|
|
374
|
-
});
|
|
375
|
-
};
|
|
376
|
-
LiveTpl.prototype.forbidMicro = function (microStatus, toUserIds) {
|
|
377
|
-
var _a, _b;
|
|
378
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
379
|
-
return tslib_1.__generator(this, function (_c) {
|
|
380
|
-
switch (_c.label) {
|
|
381
|
-
case 0:
|
|
382
|
-
if (liveController.options.canForbidUserMicro && !liveController.options.canForbidUserMicro(toUserIds)) {
|
|
383
|
-
return [2 /*return*/, false];
|
|
384
|
-
}
|
|
385
|
-
if (!((_b = (_a = this.selfInfo) === null || _a === void 0 ? void 0 : _a.permission) === null || _b === void 0 ? void 0 : _b.control_other_micro)) {
|
|
386
|
-
return [2 /*return*/, false];
|
|
387
|
-
}
|
|
388
|
-
return [4 /*yield*/, this.updateStatus(LiveMsg_1.BuiltinEventType.UserChange, LiveMsg_1.BuiltinActionType.UserMicroStatus, {
|
|
389
|
-
status: microStatus
|
|
390
|
-
}, toUserIds)];
|
|
391
|
-
case 1: return [2 /*return*/, _c.sent()];
|
|
392
|
-
}
|
|
393
|
-
});
|
|
394
|
-
});
|
|
395
|
-
};
|
|
396
|
-
/**
|
|
397
|
-
* @deprecated 暂不可用
|
|
398
|
-
*/
|
|
399
|
-
LiveTpl.prototype.forbidSync = function (sync, toUserIds) {
|
|
400
|
-
var _a, _b;
|
|
401
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
402
|
-
return tslib_1.__generator(this, function (_c) {
|
|
403
|
-
switch (_c.label) {
|
|
404
|
-
case 0:
|
|
405
|
-
if (liveController.options.canForbidUserSync && !liveController.options.canForbidUserSync(toUserIds)) {
|
|
406
|
-
return [2 /*return*/, false];
|
|
407
|
-
}
|
|
408
|
-
if (!((_b = (_a = this.selfInfo) === null || _a === void 0 ? void 0 : _a.permission) === null || _b === void 0 ? void 0 : _b.control_other_sync)) {
|
|
409
|
-
return [2 /*return*/, false];
|
|
410
|
-
}
|
|
411
|
-
return [4 /*yield*/, this.updateStatus(LiveMsg_1.BuiltinEventType.UserChange, LiveMsg_1.BuiltinActionType.UserPermission, { sync_frame: sync }, toUserIds)];
|
|
412
|
-
case 1: return [2 /*return*/, _c.sent()];
|
|
413
|
-
}
|
|
414
|
-
});
|
|
415
|
-
});
|
|
416
|
-
};
|
|
417
|
-
LiveTpl.prototype.kick = function (toUserIds) {
|
|
418
|
-
var _a, _b;
|
|
419
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
420
|
-
return tslib_1.__generator(this, function (_c) {
|
|
421
|
-
switch (_c.label) {
|
|
422
|
-
case 0:
|
|
423
|
-
if (liveController.options.canForbidUserKick && !liveController.options.canForbidUserKick(toUserIds)) {
|
|
424
|
-
return [2 /*return*/, false];
|
|
425
|
-
}
|
|
426
|
-
if (!((_b = (_a = this.selfInfo) === null || _a === void 0 ? void 0 : _a.permission) === null || _b === void 0 ? void 0 : _b.change_other_status)) {
|
|
427
|
-
return [2 /*return*/, false];
|
|
428
|
-
}
|
|
429
|
-
return [4 /*yield*/, this.updateStatus(LiveMsg_1.BuiltinEventType.UserChange, LiveMsg_1.BuiltinActionType.UserStatus, {
|
|
430
|
-
status: 'KICK_OUT'
|
|
431
|
-
}, toUserIds)];
|
|
432
|
-
case 1: return [2 /*return*/, _c.sent()];
|
|
433
|
-
}
|
|
434
|
-
});
|
|
435
|
-
});
|
|
436
|
-
};
|
|
437
|
-
LiveTpl.prototype.exit = function () {
|
|
438
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
439
|
-
return tslib_1.__generator(this, function (_a) {
|
|
440
|
-
switch (_a.label) {
|
|
441
|
-
case 0:
|
|
442
|
-
/** 退出强制关闭语音(?) */
|
|
443
|
-
return [4 /*yield*/, this.$RTC.quit()];
|
|
444
|
-
case 1:
|
|
445
|
-
/** 退出强制关闭语音(?) */
|
|
446
|
-
_a.sent();
|
|
447
|
-
return [4 /*yield*/, this.updateStatus(LiveMsg_1.BuiltinEventType.RoomChange, LiveMsg_1.BuiltinActionType.RoomClose, {})];
|
|
448
|
-
case 2: return [2 /*return*/, _a.sent()];
|
|
449
|
-
}
|
|
450
|
-
});
|
|
451
|
-
});
|
|
452
|
-
};
|
|
453
|
-
LiveTpl.prototype.connect = function (options) {
|
|
454
|
-
if (options === void 0) { options = {}; }
|
|
455
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
456
|
-
var microAuth, error, error, force, error, error, url, _a, _b, _c;
|
|
457
|
-
var _d;
|
|
458
|
-
var _this = this;
|
|
459
|
-
return tslib_1.__generator(this, function (_e) {
|
|
460
|
-
switch (_e.label) {
|
|
461
|
-
case 0: return [4 /*yield*/, this.$RTC.detectMicro()];
|
|
462
|
-
case 1:
|
|
463
|
-
microAuth = _e.sent();
|
|
464
|
-
if (!microAuth) {
|
|
465
|
-
error = new Error('系统监测麦克风未授权~');
|
|
466
|
-
this.emit('ws.error', { type: WebSocket_1.WebSocketErrorType.MicroAuth, error: error });
|
|
467
|
-
return [2 /*return*/, error];
|
|
468
|
-
}
|
|
469
|
-
// WebSocket 正在连接中,规避重复连接
|
|
470
|
-
if (liveController.connecting) {
|
|
471
|
-
error = new Error('WebSocket 正在连接中,请勿重复连接 ...');
|
|
472
|
-
this.emit('ws.error', { type: WebSocket_1.WebSocketErrorType.DuplicateConnect, error: error });
|
|
473
|
-
return [2 /*return*/, error];
|
|
474
|
-
}
|
|
475
|
-
force = options.force;
|
|
476
|
-
if (!force) {
|
|
477
|
-
if (this.readyState === WebSocket_1.WebSocketState.CONNECTING || this.readyState === WebSocket_1.WebSocketState.OPEN) {
|
|
478
|
-
return [2 /*return*/, true];
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
// WebSocket URL 逻辑
|
|
482
|
-
if (options.url) {
|
|
483
|
-
liveController.options.url = options.url;
|
|
484
|
-
}
|
|
485
|
-
if (options.getTicket) {
|
|
486
|
-
liveController.options.getTicket = options.getTicket;
|
|
487
|
-
}
|
|
488
|
-
if (!liveController.options.url || !liveController.options.url.startsWith('ws')) {
|
|
489
|
-
error = new Error("WebSocket URL \u672A\u914D\u7F6E\u6216\u683C\u5F0F\u4E0D\u5408\u6CD5\uFF1A\"".concat(liveController.options.url, "\""));
|
|
490
|
-
this.emit('ws.error', { type: WebSocket_1.WebSocketErrorType.IllegalURL, error: error });
|
|
491
|
-
return [2 /*return*/, error];
|
|
492
|
-
}
|
|
493
|
-
if (!liveController.options.getTicket) {
|
|
494
|
-
error = new Error("getTicket() \u672A\u914D\u7F6E!");
|
|
495
|
-
this.emit('ws.error', { type: WebSocket_1.WebSocketErrorType.IllegalArgs, error: error });
|
|
496
|
-
return [2 /*return*/, error];
|
|
497
|
-
}
|
|
498
|
-
// 连接锁
|
|
499
|
-
liveController.connecting = true;
|
|
500
|
-
// 连接前销毁之前绑定的事件
|
|
501
|
-
liveController.disposeWebSocket();
|
|
502
|
-
this.emit('ws.beforeConnect');
|
|
503
|
-
if (!(force || options.url || !this.url)) return [3 /*break*/, 3];
|
|
504
|
-
_b = appendUri_1.appendUri;
|
|
505
|
-
_c = [liveController.options.url];
|
|
506
|
-
_d = {};
|
|
507
|
-
return [4 /*yield*/, liveController.options.getTicket()];
|
|
508
|
-
case 2:
|
|
509
|
-
_a = _b.apply(void 0, _c.concat([(_d.ticket = _e.sent(),
|
|
510
|
-
_d.force = Number(!!force),
|
|
511
|
-
_d)]));
|
|
512
|
-
return [3 /*break*/, 4];
|
|
513
|
-
case 3:
|
|
514
|
-
_a = this.url;
|
|
515
|
-
_e.label = 4;
|
|
516
|
-
case 4:
|
|
517
|
-
url = _a;
|
|
518
|
-
liveController.webSocket = new WebSocket(url);
|
|
519
|
-
liveController.onEvtOpnListener = function () {
|
|
520
|
-
liveController.checkReadyState(_this);
|
|
521
|
-
_this.emit('ws.afterConnect');
|
|
522
|
-
};
|
|
523
|
-
liveController.onEvtMsgListener = function (evt) {
|
|
524
|
-
liveController.checkReadyState(_this);
|
|
525
|
-
try {
|
|
526
|
-
var liveMsg = (0, LiveMsg_1.parseLiveMsg)(evt.data);
|
|
527
|
-
if (liveMsg === false)
|
|
528
|
-
return;
|
|
529
|
-
liveController.handleMessage(liveMsg, _this);
|
|
530
|
-
}
|
|
531
|
-
catch (error) {
|
|
532
|
-
// 未知错误
|
|
533
|
-
_this.emit('ws.error', { type: WebSocket_1.WebSocketErrorType.Unknown, error: error, target: evt });
|
|
534
|
-
}
|
|
535
|
-
};
|
|
536
|
-
liveController.onEvtErrListener = function (evt) {
|
|
537
|
-
live.emit('ws.error', { type: WebSocket_1.WebSocketErrorType.Error, target: evt });
|
|
538
|
-
liveController.checkReadyState(_this);
|
|
539
|
-
};
|
|
540
|
-
liveController.onEvtCLEListener = function (evt) {
|
|
541
|
-
liveController.checkReadyState(_this);
|
|
542
|
-
var code = Number(evt.code);
|
|
543
|
-
if (code === 1000)
|
|
544
|
-
return;
|
|
545
|
-
// 异常退出不一定会触发'error'事件,根据 evt.code 一些类型的退出也算是 error 行为
|
|
546
|
-
var errMsg = (0, WebSocket_1.parseWSClsErr)(code);
|
|
547
|
-
live.emit('ws.error', { target: evt, type: WebSocket_1.WebSocketErrorType.Close, closeError: errMsg });
|
|
548
|
-
};
|
|
549
|
-
liveController.webSocket.addEventListener('open', liveController.onEvtOpnListener);
|
|
550
|
-
liveController.webSocket.addEventListener('message', liveController.onEvtMsgListener);
|
|
551
|
-
liveController.webSocket.addEventListener('error', liveController.onEvtErrListener);
|
|
552
|
-
liveController.webSocket.addEventListener('close', liveController.onEvtCLEListener);
|
|
553
|
-
return [4 /*yield*/, new Promise(function (resolve, reject) {
|
|
554
|
-
var success = function () {
|
|
555
|
-
resolve(true);
|
|
556
|
-
liveController.connecting = false;
|
|
557
|
-
_this.off('ws.error', fail);
|
|
558
|
-
};
|
|
559
|
-
var fail = function (error) {
|
|
560
|
-
reject(error.error ? error.error : new Error('WebSocket connection failed!'));
|
|
561
|
-
liveController.connecting = false;
|
|
562
|
-
_this.off('ws.afterConnect', success);
|
|
563
|
-
};
|
|
564
|
-
_this.once('ws.afterConnect', success);
|
|
565
|
-
_this.once('ws.error', fail);
|
|
566
|
-
})];
|
|
567
|
-
case 5: return [2 /*return*/, _e.sent()];
|
|
568
|
-
}
|
|
569
|
-
});
|
|
570
|
-
});
|
|
571
|
-
};
|
|
572
|
-
LiveTpl.prototype.revoke = function () {
|
|
573
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
574
|
-
return tslib_1.__generator(this, function (_a) {
|
|
575
|
-
return [2 /*return*/, true];
|
|
576
|
-
});
|
|
577
|
-
});
|
|
578
|
-
};
|
|
579
|
-
return LiveTpl;
|
|
580
|
-
}(Subscribe_1.Subscribe));
|
|
581
|
-
var live = new LiveTpl();
|
|
582
|
-
// 如果是调试环境则将内部状态暴露出来
|
|
583
|
-
if (options.__debug__) {
|
|
584
|
-
Object.assign(live, { __controller__: liveController });
|
|
585
|
-
Object.assign(window, { $live: live });
|
|
586
|
-
}
|
|
587
|
-
return live;
|
|
588
|
-
}
|
|
589
|
-
exports.createLive = createLive;
|
|
590
|
-
//# sourceMappingURL=createLive.js.map
|