Cocktail is cross-platform, embeddable and native.
Cocktail does not require any virtual machine, it is not interpreted.
This has a positive impact on the performance and allows access to native functionalities and libraries in native language such as objective C, C++, php, ActionScript…
Cocktail is a project supported by Silex Labs. It is a cross-platform library for the Haxe programming language.
- mobiles and tablets (iOS, Android, BlackBerry...)
- desktop computers (Windows, Mac, Linux)
- televisions (Google TV, Adobe Air for TV, HbbTV (european smart TV standard))
- all major browsers, in HTML5 with a Flash fallback
- PHP, in order to be able to generate and manipulate the client "view" on the server side
Note1: we plan to be able to output native apps directly with Haxe compiler, in c++, java, .net
Right away, a code sample: load and display an image
// create an image tag and load a picture var image = js.Lib.document.createElement("img"); image.src = "picture.png"; // apply style to position it on the page image.style.position = "absolute"; image.style.display = "block"; // center the image backGround.style.top = "50%"; backGround.style.left = "50%";
<html> <head> <title>Code before talking</title> </head> <body> <div style="text-align:center;"> <img id="icon" alt="cocktail" src="assets/icone_cocktail_blanche_ombre.png" width="132" height="132" style="position:absolute; display:block; top:40%; left:40%;"> </img> </div> </body> </html>
For more practical informations (compilation and more) , see the Getting started with Cocktail guide.
Check Cocktail supported platforms for the detailed list.
The goals and the strategical orientation are
- address the dilemmas of cross-platform UIs and DOM manipulation
- cross-platform liquid UIs
- semantic when needed
- clean and simple generated DOM (no useless containers)
- access to native controls and UI elements
- elegant way of dealing with cross target issues
- handle the target capabilities
- API to provide alternative formats
- Cocktail supported platforms
- Cocktail future platforms
- Official Cocktail definition
- Cocktail's road map
- Cocktail BSD & MIT licenses
- W3C CSS unit tests
Articles and demos