enyo.Hybrid
The Hybrid control is used to instantiate a PDK hybrid object within an Enyo application.
In order to have mouse events passed to the hybrid plugin, you need to add your own requiresDomMousedown property to the control, with the value true.
Non-visible plugins are supported with width and height of 0. They are still in the DOM of the page, and re-rendering them will cause the plugin executable to be shut down and restarted. The enyo.Hybrid code will automatically apply a "float: left" style to 0-size plugins so they don't interfere with page layout.
If you use a hybrid in a non-webOS context, only the width and height properties are used, creating an inert object with no methods or behavior. This is mainly useful for testing how the control interacts with your application layout.
Published Properties
| Name | Type | Description |
| executable | "" | (Required) Name of plugin executable to run |
| params | [] | (Optional) Array of strings; if provided, the strings are used as command line parameters to the plugin. |
| alphaBlend | false |
(Optional) Set to true to enable premultiplied alpha-blending for plugins. Enable if you want to blend the plugin display contents with the HTML elements below it on the page. Set to false for faster drawing.
|
| killTransparency | false |
(Optional) Set to true to stop plugin layer from clearing transparency information from display surface. Should always be used with alphaBlend: false. Used to allow showing video layer from video tag playback through a hybrid object.
|
| cachePlugin | false |
(Optional) If true, plugin will remain alive when hidden. This is useful if you're hosting the plugin in a pane or other part of the page where you don't want the plugin process to be killed and restarted later.
|
| allowKeyboardFocus | false |
(Optional) If true, allows plugin to get focus when tapped by setting its tabIndex property.
|
| bgcolor | null |
(Optional) Background color to use for displaying plugin before initial draw or during resize. It's a string of the form "rrggbb" using hex digits, with "000000" being black and "FFFFFF" being white. If null, uses default gray color. This value can only be set at creation time.
|
| height | 0 | Height of the plugin object |
| width | 0 | Width of the plugin object |
Published Events
| Name | Type | Description |
| onPluginReady | "" |
Sent when the plugin is ready to allow method calls. This is either signaled directly by remoteadapter on newer webOS builds, or signaled by the plugin code using PDL_CallJS() to call the "ready" method.
|
| onPluginConnected | "" | Sent when the plugin executable has been started and has a made a connection back to the plugin |
| onPluginDisconnected | "" | Sent when the plugin executable has disconnected, usually because the process has ended |
Methods
addCallback(name, callback, defer)
Adds a callback function to the plugin object that can be called via PDL_CallJS() from the plugin.
name is a string, the name to use for the callback method on the plugin.
callback is a function that will be called with this pointing to the actual DOM node of the plugin, so use enyo.bind to redirect it to the appropriate context.
defer is an optional boolean. If true, the callback will be called asynchronously, so it can make calls back into the plugin.
callPluginMethod(methodName)
Calls a method on the plugin, with the result returned immediately to the caller. The arguments to the method are supplied as arguments to this function after the method name as a string.
If the hybrid plugin is not ready for calls, this will throw an exception.
callPluginMethodDeferred(callback, methodName)
Calls a method on the plugin with the result returned through a callback function.
If the hybrid plugin is not ready for calls, this will defer the call to be done after the plugin is ready.
You can pass null as the callback if you don't care about the result.
focus()
Tells the system to put focus on the hybrid window and show the onscreen keyboard, if available.