PDL_RegisterPollingJSHandler

Description

Same as PDL_RegisterJSHandler, but instead of the JS handler being called immediately, the request is put in a queue, and an event is posted to SDL to alert you. You must call PDL_HandleJSCalls to have the actual handlers be called. This approach ensures that the handlers are called in your thread (as opposed to PDL_RegisterJSHandler, which calls them immediately from an internal PDK thread).

The event your app gets is SDL_USEREVENT, and the event's user.code value is PDL_PENDING_JS.

Note that your app does not get an event for each JS call. It gets one event notifying it that there are queued calls. It does not get another such event until it calls PDL_HandleJSCalls and there is another downstream call.

Note: This API has been available since webOS 3.0.2 (PDK version 303).

Syntax

PDL_Err PDL_RegisterPollingJSHandler(const char *functionName, PDL_JSHandlerFunc function);

Argument Description
functionName The name the JavaScript application can use to reference the Plug-in handler function.
function The Plug-in application function.

Returns

PDL_NOERROR - Success.
PDL_ESTATE - You can not register new JS handlers after calling PDL_JSRegistrationComplete.

See also: