Skip to content

Legacy API: Common

Hyojin Kim edited this page Mar 21, 2017 · 3 revisions

For converting Application API of Legacy to TOAST API, please refer to the followings.

If you want more information, please refer to toast.application

exit

  • Before

    var widgetAPI = new Common.API.Widget();
    widgetAPI.sendReturnEvent(); // or widgetAPI.sendExitEvent();
    curWidget.setPreference('return', 'true'); // or curWidget.setPreference('exit', 'true');
  • After

    toast.application.exit();

launchApp

  • Before

    var appId ='xxxxxxxx';
    var data = window.curWidget.id + '?' + appId + '?' + '&data=...';
    var widgetType = '02'; // '3010' : webbrowser, '02' : widget
    
    var widgetEvent = new WidgetEvent(widgetType, data);
    sendWidgetEvent('', widgetEvent, false);
  • After

    toast.application.launchApp({appId: 'xxxxxxx', data: {url: 'http://...', info: 'This is video url.'}}, function() {
        console.log('success');
    }, function(err) {
        console.log('fail' + err.message);
    });

getRequestedAppInfo

  • Before

    var originalData = window.location.search;
    // You can find the app id behind '&callerid=' in originalData
    // You can find the receiving data by caller in originalData ex) '&data=.....'
    console.log(originalData);
  • After

    toast.application.getRequestedAppInfo(function(reqAppInfo) {
        console.log('success' + reqAppInfo.callerAppId + ' ' + JSON.stringify(reqAppInfo.data));
    }, function(err) {
        console.log('fail' + err.message);
    });
Clone this wiki locally