
# 共享开关
#### 接口描述
控制共享功能是否启用。
#### 注意事项
前置条件:已经建立与OpenEyeCall的WebSocket连接。
#### 方法定义
```
OpenEyeCall.prototype.shareControl = function(value, callbacks)
```
#### 参数描述
表1参数说明 
| 参数名       | 类型                                                             | 可选/必选 | 描述        |
|:---|:---|:---|:---|
| value     | bool                                                           | 必选    | 共享开关是否打开。 |
| callbacks | [Callback] | 必选    | 回调方法。     |
   
 表2Callback 
| 参数名      | 类型       | 可选/必选 | 描述                                                                 |
|:---|:---|:---|:---|
| response | function | 必选    | 回调方法的入参请参考[表3] |
   
 表3回调方法的入参 
| 参数名         | 类型     | 描述                 |
|:---|:---|:---|
| description | String | 当前请求描述。            |
| result      | Number | 设置结果。0表示成功，其他表示失败。 |
| rsp         | Number | 内部消息编号。            |
   
![](https://support.huaweicloud.com/devg-openeye-cec/public_sys-resources/note_3.0-zh-cn.png)
回调方法的入参示例：
```
{
   "description" : "tsdk_share_evt_stopsharewindow",
   "result" : 0,
   "rsp" : 67760
}
```
#### 使用示例
```
function switchShare() {
 var ischecked = document.getElementById("share-control-toggle-button").checked;
 if (ischecked) {
  console.info("switchShare ischecked true.");
  shareSwitch = true;
  document.getElementById("shareControlDiv").style.visibility = "visible";
  this.global_openEye_SDK.openEyeCall.shareControl(shareSwitch, { response: switchShareRespone })
 } else {
  console.info("switchShare ischecked false.");
  shareSwitch = false;
  document.getElementById("shareControlDiv").style.visibility = "hidden";
  this.global_openEye_SDK.openEyeCall.shareControl(shareSwitch, { response: switchShareRespone })
 }
}
function switchShareRespone(data){
 console.log(data);
 if (data.result == 0) {
        console.info("switchShare Success");
    } else {
        console.error("switchShare failed");
        console.error(data);
    }
}
```
