@shencom/rms-device-sdk
v1.5.0
Published
深分类设备SDK
Downloads
6
Readme
@shencom/rms-device-sdk
深分类设备 SDK
Build
yarn release
Example
Html
Install
npm view @shencom/rms-device-sdk versions
可以查看版本号或去 oss 查
<script src="https://oss.shencom.cn/plugins/lib/rms-device-sdk/1.x.x/index.js"></script>
Use
<script>
window.onload = function () {
if (window.rms_sdk.isApp) {
// 获取设备信息
window.rms_sdk.deviceInfo((data) => {
console.log('deviceInfo :>> ', data.data);
});
// 获取网络状态
window.rms_sdk.network((network) => {
console.log('network :>> ', data.data);
});
// promise
window.rms_sdk.deviceInfo().then((data) => {
console.log('deviceInfo :>> ', data.data);
});
window.rms_sdk.network().then((data) => {
console.log('network :>> ', data.data);
});
}
function webviewReload() {
// 切换页面
window.rms_sdk.webviewReload('http://xxx/xxx.html', function () {
console.log('切换页面 success');
});
}
function webviewReload() {
// 刷新页面
window.rms_sdk.webviewReload(null, function () {
console.log('刷新 success');
});
}
};
</script>
Npm
Install
npm install @shencom/rms-device-sdk
# or
yarn add @shencom/rms-device-sdk
# or
pnpm add @shencom/rms-device-sdk
Use
import rms_sdk from '@shencom/rms-device-sdk';
// 获取设备信息
rms_sdk.deviceInfo((data) => {
console.log('deviceInfo :>> ', data.data);
});
// 获取网络状态
rms_sdk.network((data) => {
console.log('network :>> ', data.data);
});
// 切换页面
rms_sdk.webviewReload('http://xxx/xxx.html', function () {
console.log('切换页面 success');
});
// 刷新页面
rms_sdk.webviewReload(null, function () {
console.log('刷新 success');
});
// promise
rms_sdk.webviewReload('http://xxx/xxx.html').then(() => {
console.log('切换页面 success');
});
rms_sdk.webviewReload(null).then(() => {
console.log('刷新 success');
});