Rand Stats

UI::HTMLWindow

zef:guifa

GUI::HTMLWindow

This is a highly experimental module. Not so experimental in whether it works (it does), but rather in how developers will interact with it.

Quickstart

window MyWindow {
    # foo exists in the website
    method foo is js-outbound { * }
    
    # bar is callable from the website
    method bar($str) is js-inbound { 
        say $str;
    }
}

with $window = MyWindow.new {
    .add-file: "index.html";
    .add-file: "style/main.css";
    .homepage = 'index.html";
}

$window.open: :640width, :480height;

$window.foo;  # calls foo() in JavaScript in the window

Guide

The UI::HTMLWindow package enables a new declarator, window, which represents a window that is filled with a web view. It is a subclass of the Window class, which will handle all of the magic for you, however, you can add your own methods and has-scoped variables.

In addition to the window, there are two traits that you can use for your methods:

If you have a lot of files to add that are fairly consistent, you may wish to do them during a TWEAK phase. Files are specified from the resources folder. At present, files are added to a temporary folder maintaining whatever structure may exist in the resources folder. Adding non-resource files will be supported in a future version.

Beta notes

Version History