@ott-smarttv/util-native
v1.2.5
Published
Util detect platform SmartTV
Downloads
13
Maintainers
Readme
Osiris SmartTV Native Util
Setup
NativeUtil.getInstance()?.loadScripts({
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)
})
}, [])