@osiris-smarttv/util-native
v1.3.0
Published
Util detect platform SmartTV
Downloads
4
Maintainers
Readme
Osiris SmartTV Native Util
Setup
NativeUtil.getInstance()?.init({
scripts: undefined,
onLoadSuccess: (data) => {
ReactDOM.render(
<App />
,
document.getElementById('root')
);
},
})
Example
useEffect(() => {
(async () => {
const res = await UtilNative.getInstance()?.getBaseInfo()
setRes(() => res)
console.log("🚀 ~ res:", res)
})()
UtilNative.getInstance()?.onEvent(ListenerEvent.NETWORK_CHANGE, (res) =>
{
console.log("🚀 ~ network:", res)
setNetwork(() => res)
})
UtilNative.getInstance()?.onEvent(ListenerEvent.MOUSE_ENABLE, (e) => {
console.log('mouse', e)
setMouse(() => e)
})
UtilNative.getInstance()?.onEvent(ListenerEvent.STATUS_KEYBOARD_CHANGE,
(e) => {
console.log('keyboard', e)
setKeyboard(() => e)
})
}, [])