github.com/TheEEs/alizarin
0.3.2 / published Jun 19, 2021 / repository
Writes Linux GUI applications using Web Technologies. Extending JavaScript with native functionalities.
Alizarin
Alizarin is a Crystal shard that helps you build Linux GUI applications using Web Technologies (HTML5, CSS3, JavaScript). This shard also provides ability to extend JavaScript code with native functionalities.
Examples
Markdown - A markdown editor written with Alizarin
Installation
- Add the dependency to your
shard.yml:
dependencies:
alizarin:
github: TheEEs/alizarin
- Run
shards install
NOTE: This shard requires libwebkit2gtk-4.0 to be installed. Makes sure you have it installed into your system.
$ sudo apt-get install -y libwebkit2gtk-4.0
Usage
require "alizarin"
- Open a browser window and load Crystal Offical Website
require "alizarin"
require "colorize"
webview = WebView.new
webview.on_close do |webview|
puts "#{webview} is going to close".colorize :green
exit 0
end
webview.window_size 800, 600
webview.load_url "https://crystal-lang.org/"
webview.run
- Show WebInspector (in case if you want to play with page's source code)
webview["enable-developer-extras"] = true
webview.show_inspector
NOTE: There is also test cases located in /spec folder.
To run test case, types:
$ git clone https://github.com/TheEEs/alizarin
$ cd alizarin
$ make
$ crystal spec
See Alizarin API for more.
Development
TODO: Write Development instructions here.
Contributing
- Fork it https://github.com/TheEEs/alizarin/fork
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request
Author
- TheEEs - creator and maintainer
API
- Alizarin
- Invokable
Invokablesupports calling member function of a JavaScript's Object. - JSCContext
JSCContext represents a JavaScript execution context
- JSCFunction
JSCFunction represents a JavaScript's native function(a function that run native code instead of javascript).
- JSCObject
A JSCObject represent a JavaScript object
- JSCPrimative
A JSCPrimative is a wrapper of 5 JavaScript primative types, includes: 1.
- JSObjectUtils
This module provides common operations that every JavaScript entity can do
- WebExtension
According to architecture of WebKit2GTK, JavaScript code runs in a separeted process called Render Process.
- WebView
A
WebViewis a class which represents a WebKit2GTK browser window.