evmux-app-framework 0.1.11 → 0.1.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "evmux-app-framework",
3
- "version": "0.1.11",
3
+ "version": "0.1.12",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -55,7 +55,7 @@ export const availableRequests = {
55
55
  getParticipants: "getParticipants",
56
56
  accountPlanCapabilities: "accountPlanCapabilities",
57
57
  upgradePopup: "upgradePopup",
58
-
58
+ getVolumeMultiplier: "getVolumeMultiplier",
59
59
 
60
60
  }
61
61
 
@@ -159,6 +159,36 @@ let createEventResultObject = (requestName, eventName, result) => {
159
159
 
160
160
  }
161
161
 
162
+ raiseEventForComponent(userAppInstanceId, componentId, eventName, data) {
163
+ const appInstance = this._userAppInstances[userAppInstanceId]
164
+ if (!appInstance || !appInstance.events || !appInstance.events[eventName]) return
165
+ const component = appInstance.instances[componentId]
166
+ if (!component) return
167
+ const eventObj = createEventResultObject("EvEvent", eventName, data)
168
+ component.window.postMessage(JSON.stringify(eventObj), "*")
169
+ }
170
+
171
+ getComponentCount(userAppInstanceId) {
172
+ const appInstance = this._userAppInstances[userAppInstanceId]
173
+ if (!appInstance || !appInstance.instances) return 0
174
+ return Object.keys(appInstance.instances).length
175
+ }
176
+
177
+ setComponentVolumeMultiplier(userAppInstanceId, componentId, value) {
178
+ const appInstance = this._userAppInstances[userAppInstanceId]
179
+ if (appInstance && appInstance.instances && appInstance.instances[componentId]) {
180
+ appInstance.instances[componentId].volumeMultiplier = value
181
+ }
182
+ }
183
+
184
+ getComponentVolumeMultiplier(userAppInstanceId, componentId) {
185
+ const appInstance = this._userAppInstances[userAppInstanceId]
186
+ if (appInstance && appInstance.instances && appInstance.instances[componentId]) {
187
+ return appInstance.instances[componentId].volumeMultiplier ?? 1
188
+ }
189
+ return 1
190
+ }
191
+
162
192
  signalApp(userAppInstanceId, data){
163
193
  let theApp = this._userAppInstances[userAppInstanceId]
164
194
  if(theApp && theApp.events[availableEvents.signalingEvent]){
@@ -214,6 +244,7 @@ let createEventResultObject = (requestName, eventName, result) => {
214
244
 
215
245
  this._userAppInstances[requestObj.userAppInstanceId].instances[requestObj.componentId] = { window: evt.source }
216
246
  this._eventHandler.publish("appComponentLoaded", requestObj)
247
+ this._eventHandler.publish("componentCountChanged", { userAppInstanceId: requestObj.userAppInstanceId })
217
248
 
218
249
  result = this.getAppSettingsForAppInstanceId(requestObj.userAppInstanceId)
219
250
  }
@@ -228,6 +259,10 @@ let createEventResultObject = (requestName, eventName, result) => {
228
259
  this._makeSureAppInstanceExist(requestObj.userAppInstanceId);
229
260
  delete this._userAppInstances[requestObj.userAppInstanceId].events[requestObj.data.eventName]
230
261
  }
262
+ else if (requestObj.request == availableRequests.getVolumeMultiplier)
263
+ {
264
+ result = { value: this.getComponentVolumeMultiplier(requestObj.userAppInstanceId, requestObj.componentId) }
265
+ }
231
266
  else {
232
267
  for (let i = 0; i < this._requestHandlers.length; i++)
233
268
  {
@@ -255,9 +290,10 @@ let createEventResultObject = (requestName, eventName, result) => {
255
290
  {
256
291
  if (this._userAppInstances[userAppInstanceId] && this._userAppInstances[userAppInstanceId].instances[componentId]) {
257
292
  delete this._userAppInstances[userAppInstanceId].instances[componentId]
293
+ this._eventHandler.publish("componentCountChanged", { userAppInstanceId })
258
294
  if (Object.keys(this._userAppInstances[userAppInstanceId].instances).length == 0)
259
295
  {
260
- delete this._userAppInstances[userAppInstanceId]
296
+ delete this._userAppInstances[userAppInstanceId]
261
297
  }
262
298
  }
263
299
  }
@@ -27,6 +27,7 @@ export const availableEvents = {
27
27
  signalingEvent: "signalingEvent",
28
28
  participantJoined: "participantJoined",
29
29
  participantLeft: "participantLeft",
30
+ volumeMultiplier: "volumeMultiplier",
30
31
  }
31
32
 
32
33
  export const layerTypes = {
@@ -101,6 +102,11 @@ export default class EvmuxAppsApi {
101
102
  let reqObj = {request: availableRequests.getSettings, userAppInstanceId: this._userAppInstanceId, componentId: this._componentId}
102
103
  return this._postMessageManager.sendRequestAsync(reqObj);
103
104
  }
105
+
106
+ async getVolumeMultiplier() {
107
+ let reqObj = {request: availableRequests.getVolumeMultiplier, userAppInstanceId: this._userAppInstanceId, componentId: this._componentId}
108
+ return this._postMessageManager.sendRequestAsync(reqObj);
109
+ }
104
110
 
105
111
  raiseAppMessagingEvent(data) {
106
112
  let requestObj = {