Constructor
ZGHL - 小智 jssdk
Example
const zghl = new ZGHL({
authInfo:{
refresh_url: 'https://openapi.zhiguohulian.com/openapi/v1/oauth/token',
refresh_token: "",
access_token: "",
token_type: "",
expires: "",
host: ""
},
onReady: function(){
console.log('ready')
},
onError: function(errMsg){
console.log('Error:', errMsg)
}
})
// MQTT 开门事件
zghl.on('openDoorSuccess', function(message){
console.log(message)
})
// Error 事件
zghl.on('error', function(message){
console.log(message)
})
Parameters:
| Name |
Type |
Description |
option |
Object
|
Properties
| Name |
Type |
Description |
authInfo |
String
|
认证信息
Properties
| Name |
Type |
Description |
refresh_url |
String
|
刷新token地址,默认:https://openapi.zhiguohulian.com/openapi/v1/oauth/token |
refresh_token |
String
|
|
access_token |
String
|
|
token_type |
String
|
|
expires |
String
|
|
host |
String
|
|
|
onReady |
function
|
初始化完成回调 |
onError |
function
|
错误回调 |
|
Returns:
-
Type
-
InstanceModel