confirm Method

This method will display a modal alert box with confirmation options.

intel.xdk.notification.confirm(message,confirmEventID,title,confirmButtonText,dismissButtonText);

Description:

This method will display a modal alert box that allows the user to confirm or ignore the message. The message text, function to execute on confirmation event being thrown, title, and the text for the confirm and dismiss buttons are all defined by the parameters passed to this method.

Platforms:

Parameters:

  • message: The confirmation message to show in the alert box.
  • confirmEventID: Event ID of the confirmation. Used to identify which confirm message to process when event a confirm event is thrown.
  • title: The title to put across the top of the alert box.
  • confirmbuttontext: The text to put on the button that confirms the action shown in the alert box.
  • dismissbuttontext: The text to put on the button that dismisses the action shown in the alert box.

Events:

  • intel.xdk.notification.confirm: Upon completion, this method will fire the intel.xdk.notification.confirm event that includes a "success", "answer", and "id" properties. If success, "answer" will be set to "true" for confirmation, and "id" contains the value of the confirmEventID parameter provided in the function call.

Example:


//  Set up confirmation event listener
document.addEventListener('intel.xdk.notification.confirm', receiveConfirm, false);

//  Display the confimation alert message
intel.xdk.notification.confirm("Launch native maps?", 'launchMaps', "Show A Map", "Yes", "No");

//Process the event for the confirmed message
function receiveConfirm(e)
        {
                if( e.id == 'launchMaps' )
                {
                        if( e.success == true && e.answer == true ) 
                        {
                                var url = "http://google.com/maps?saddr=35+East+Orange+St+Lancaster,+Harrisburg,+PA+17602&daddr=1600+Pennsylvania+Ave+Washington,+DC+20006";
                                //alert(url);
                                //console.log(url);
                                intel.xdk.device.launchExternal(url);
                        }
                }
        }                                         
            
Per informazioni più dettagliate sulle ottimizzazioni basate su compilatore, vedere il nostro Avviso sull'ottimizzazione.