Forum

Connecting db8

How to connect db8 and front-end ?

@Pritam-CU : You can connect to db8 using LS2 services.
Refer to : com.webos.service.db | webOS Open Source Edition

@Pritam-CU ,
You can use build in enact library(https://enactjs.com/docs/modules/webos/LS2Request/) to connect db8 and shared sample web app in the web app development training session .
or you can use plain JavaScript as below to connect LS2rquest

<script type="text/javascript">
    var bridge = new WebOSServiceBridge();
    var url = 'luna://com.webos.service.systemservice/clock/getTime';
    var params = '{}';

    function callback(msg){
        var arg = JSON.parse(msg);
        if (arg.returnValue) {
            webOSSystem.PmLogString(6, "GETTIME_SUCCESS", '{"APP_NAME": "example web app"}', "UTC : " + arg.utc);
        }
        else {
            webOSSystem.PmLogString(3, "GETTIME_FAILED", '{"APP_NAME": "example web app"}', "errorText : " + arg.errorText);
        }
    }

    bridge.url = url;
    bridge.onservicecallback = callback;
    bridge.call(url, params);
</script>

Thank you for the help.
I know how to use queries in the console but it will be helpful if you give some more insights on how to implement the same in webapp(js).