virsical-jssdk
Advanced tools
Comparing version 0.1.10 to 0.1.11
32
index.js
@@ -6,2 +6,5 @@ ;(function (global, factory) { | ||
}(this, (function () { | ||
// document.write(" <script language=\"javascript\" src=\"qwebchannel.js\" > </script>"); | ||
'use strict'; | ||
@@ -16,2 +19,3 @@ var Virsical; | ||
var _platform_mac = 3; | ||
var _platform_Windows = 4; | ||
@@ -28,2 +32,10 @@ | ||
} | ||
//Windows终端接口 | ||
function clickConfig(id, secret) { | ||
new QWebChannel(qt.webChannelTransport, function (channel) { | ||
var content = channel.objects.content; | ||
content.clickConfig(id,secret); | ||
}); | ||
} | ||
@@ -38,3 +50,5 @@ function getPlatform(){ | ||
return _platform_mac; | ||
}else{// 其他设备 | ||
}else if(u.indexOf('QtWebEngine')> -1){//Windows终端 | ||
return _platform_Windows; | ||
}else{// 其他设备 | ||
return _platform_other; | ||
@@ -49,3 +63,7 @@ } | ||
if(platform == _platform_android){ | ||
window.control.config(info.debug, info.client_id, info.client_secret); | ||
try { | ||
window.control.config(info.debug, info.client_id, info.client_secret); | ||
} catch(e) { | ||
throw new Error(e); | ||
} | ||
isDebugger = info.debug; | ||
@@ -55,3 +73,7 @@ }else if(platform==_platform_ios || platform == _platform_mac ){ | ||
window.location.href = 'vsk3browser://config?'+'debug='+info.debug+'&'+'clientid='+info.client_id+'&'+'clientsecret='+info.client_secret; | ||
}else if(platform==_platform_Windows){ | ||
//TODO Windows | ||
clickConfig(info.client_id, info.client_secret); | ||
} | ||
throw new Error("Device validation failed, only support for mobile devices"); | ||
} | ||
@@ -103,3 +125,7 @@ | ||
if(platform==_platform_android){ | ||
window.control.login(); | ||
try { | ||
window.control.login(); | ||
} catch(e) { | ||
throw new Error(e); | ||
} | ||
}else if(platform==_platform_ios || platform == _platform_mac){ | ||
@@ -106,0 +132,0 @@ //TODO ios |
{ | ||
"name": "virsical-jssdk", | ||
"version": "0.1.10", | ||
"version": "0.1.11", | ||
"description": "Virsical 3.0 JS SDK", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
10436
246
3