
Security News
Happy Birthday, Shai-Hulud
It has been one year since Shai-Hulud made its first appearance on npm.
@ticos/miniprogram-sdk
Advanced tools
npm i @ticos/miniprogram-sdk
// 初始化
import { iotEventType, TicosIotSdk, IDevice } from '@ticos/miniprogram-sdk';
const getToken = async () => {
//建议通过服务端获取
const res = await axios.post('https://api.ticos.cn/auth/miniapp/login', {
code: xxx, //微信code, 调用微信接口获取
appId: xxx, //在管理控制台配置小程序接入后获取
appSecret: xxx //在管理控制台配置小程序接入后获取
})
return res.data;
}
const sdk = new TicosIotSdk({
getToken,
});
sdk.init();
// 获取绑定设备列表
const { deviceList } = await sdk.cloudApi.getDeviceList();
// 绑定设备
await sdk.cloudApi.bindDevice({ productId: 'pro001', deviceId: 'device001' })
// 解绑设备
await ticosSdk.cloudApi.unbindDevice({ productId: 'pro001', deviceId: 'device001' })
// 监听设备, 通过设备ID 和产品ID 监听
sdk.subscribe([{productId: 'pro001', deviceId: 'device001'}, {productId: 'pro001', deviceId: 'device002'}]);
sdk.onMessage(iotEventType.TICOS_IOT_EVENT_PROPERTY, (message) => {
console.log('*********device property change', message);
})
sdk.onStatus((message) => {
console.log('*********device status change ', message);
})
其他功能或接口使用请参考 https://docs.ticos.cn/
FAQs
## 安装
The npm package @ticos/miniprogram-sdk receives a total of 81 weekly downloads. As such, @ticos/miniprogram-sdk popularity was classified as not popular.
We found that @ticos/miniprogram-sdk demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.

Security News
It has been one year since Shai-Hulud made its first appearance on npm.

Research
/Security News
Operators behind PolinRider used a compromised GitHub account to plant malware in four development versions of a Packagist package with 700,000+ downloads.

Security News
GitHub Actions now supports cache-mode, a least-privilege control on the Actions cache aimed at the cache poisoning technique behind recent compromises.