0.9 M6
Pre-releaseModule system
We've implemented a Node.js / CommonJS compatible module API. To start with the most drastic change, instead of an index.json
file, Tabris.js applications must now contain a package.json
file. This is the standard manifest file that describes a module. This file must contain a field main
that points to the main JavaScript file. You can also use this file to declare dependencies and install them from npm.
If your application consists of multiple files, the main file must include other modules using the require()
function. Modules can export variables using the exports
or module.exports
object. For details, please refer to the Node.js description or have a look at our examples.
Cordova integration
We've integrated support for Cordova plug-ins to access device functions. The developer clients have a number of built-in modules. Please have a look at our cordova example. We plan to make it possible to include custom Cordova plug-ins in a Tabris.js application.
In order to support Cordova, we've also improved DOM compatibility by providing common Web API such as the global navigator
object.
Widget API changes
- The Widget property
visibility
has been renamed tovisible
. - The
image
property has been removed fromCheckBox
andRadioButton
. - The
ScrollComposite
propertyscroll
has been renamed todirection
. - The
Action
propertyplacementPriority
accepts only the lower case values (low
,high
, andnormal
)
New API
- A basic
Video
widget has been added. See the video snippet for an example. - The
TabFolder
widget has a new propertytabBarLocation
to set the position of the tab bar. Supported values aretop
,bottom
, andauto
. - The
WebView
widgets supports a new propertyhtml
that accepts an entire HTML document. Composite
now supports the eventsaddchild
andremovechild
that are fired whenever a new child is added to/removed from a Composite.- Device information is provided by a global object
device
with the propertiesmodel
,platform
, andversion
. - The
Text
widget supports a new eventchange:text
that is fired on text modification (i.e. while typing). - Images are now also accepted as a plain strings. This is a shortcut for
{url: string}
. - Colors now support the keyword
transparent
as value. Just like in CSS, this is a synonym forrgba(0, 0, 0, 0)
. - The Widget method
children()
accepts a new optional parameterselector
to filter the returned elements (currently only by type).
The method now returns an array-like collection with the methodsfirst()
andlast()
to access the first/last element.
The methodstoArray()
,forEach()
, andindexOf()
are also available.
Non-functional changes
We've added checks for property names and values. In case of a misspelled property names or an illegal property value, you should now see a warning in the developer console in most cases.