ref(iframe_api): Use EventEmitter

This commit is contained in:
hristoterezov
2017-03-31 11:38:44 -05:00
parent 78119df2db
commit d416fd8c0f
2 changed files with 24 additions and 24 deletions

View File

@@ -123,12 +123,13 @@ You can also execute multiple commands using the `executeCommands` method:
```javascript
api.executeCommands(commands)
```
The `commands` parameter is an object with the names of the commands as keys and the arguments for the commands asvalues:
The `commands` parameter is an object with the names of the commands as keys and the arguments for the commands as values:
```javascript
api.executeCommands({displayName: ['nickname'], toggleAudio: []});
```
You can add event listeners to the embedded Jitsi Meet using the `addEventListener` method.
*NOTE: This method still exists but it is deprecated. JitsiMeetExternalAPI class extends [EventEmitter]. Use [EventEmitter] methods (`addListener` or `on`).*
```javascript
api.addEventListener(event, listener)
```
@@ -198,6 +199,7 @@ changes. The listener will receive an object with the following structure:
You can also add multiple event listeners by using `addEventListeners`.
This method requires one argument of type Object. The object argument must
have the names of the events as keys and the listeners of the events as values.
*NOTE: This method still exists but it is deprecated. JitsiMeetExternalAPI class extends [EventEmitter]. Use [EventEmitter] methods.*
```javascript
function incomingMessageListener(object)
@@ -216,12 +218,13 @@ api.addEventListeners({
```
If you want to remove a listener you can use `removeEventListener` method with argument the name of the event.
*NOTE: This method still exists but it is deprecated. JitsiMeetExternalAPI class extends [EventEmitter]. Use [EventEmitter] methods( `removeListener`).*
```javascript
api.removeEventListener("incomingMessage");
```
If you want to remove more than one event you can use `removeEventListeners` method with an Array with the names of the events as an argument.
*NOTE: This method still exists but it is deprecated. JitsiMeetExternalAPI class extends [EventEmitter]. Use [EventEmitter] methods.*
```javascript
api.removeEventListeners(["incomingMessage", "outgoingMessageListener"]);
```
@@ -240,3 +243,4 @@ NOTE: It's a good practice to remove the conference before the page is unloaded.
[config.js]: https://github.com/jitsi/jitsi-meet/blob/master/config.js
[interface_config.js]: https://github.com/jitsi/jitsi-meet/blob/master/interface_config.js
[EventEmitter]: https://nodejs.org/api/events.html