Skip to content

Latest commit

History

35 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

QuickUI

  • Build desktop apps with JavaScript, HTML, and CSS.
  • Based on QuickJS and WebUI.
  • Allow you to use any browser as a GUI render engine.
  • Light weight (about 1M) & Small memory footprint.
  • Feature rich.

Quick Start

constwin=newWin();win.show("<html><script src=\"webui.js\"></script> Hello World! </html>");webui.wait();
  1. Save this code in main.js.
  2. Place main.js in the same directory as QuickUI.exe.
  3. Start QuickUI.exe.

API

webui

wait

// main.js// If There is one or more browser window,// wait until all browser window get closed or when calling webui_exit().// else if the browser did not get started, wait() will break after 30 seconds.webui.wait();

exit

// main.js// Try to close all opened windows and make wait return. // All WebUI memory resources will be freed, and this will makes WebUI unusable.webui.exit();

setTimeout

// main.js// Set wait 10 seconds for the browser to start.webui.setTimeout(10);// Now, After 10 seconds, if the browser did not get started, wait() will break.webui.wait();
// main.js// Set wait foreverwebui.setTimeout(0);// Now, wait() will never end.webui.wait();

Win

Win is a class.

show

// create window object.constwin=newWin();// Show a window using embedded HTML.win.show("<html><script src=\"webui.js\"></script> Hello World! </html>");webui.wait();
// create window object.constwin=newWin();// Show a window using a file.win.show("index.html");webui.wait();

showBrowser

//main.js// Same as `win.show`. But using a specific web browser.// 0: No web browser// 1: Default recommended web browser// 2: Google Chrome// 3: Mozilla Firefox// 4: Microsoft Edge// 5: Apple Safari// 6: The Chromium Project// 7: Opera Browser// 8: The Brave Browser// 9: The Vivaldi Browser// 10: The Epic Browser// 11: The Yandex Browser// 12: Any Chromium based browserwin.showBrowser("index.html",2);

setIcon

// main.js// Set the default embedded HTML favicon.// myIcon = "<svg>...</svg>"// myIconType = "image/svg+xml"// // myIcon = "data:image/..."// myIconType = "image/png"win.setIcon(myIcon,myIconType);

setPosition

// main.js// Set the window position.win.setPosition(x,y);

setSize

// main.js// Set the window size.win.setSize(width,height);

navigate

// main.js// Navigate to a specific URLleturl="page.html";win.navigate(url);

getUrl

// main.js// Get the full current URL.leturl=win.getUrl(url);

setKiosk

// main.js// Set the window in Kiosk modeconstwin=newWin();win.setKiosk(true);win.show("index.html");

setPublic

//Allow a specific window address to be accessible from a public network.win.setPublic(true);

setProxy

//Set the web browser proxy_server to use. Need to be called before `webui_show()`.win.setProxy("http://127.0.0.1:8888");

setRootFolder

//Set the web-server root folder path for a specific window.constwin=newWin();win.setRootFolder("ui")//Path relative to QuickUI.exe or full pathwin.show("index.html");webui.wait();

close

// main.js// Close a specific window only. The window object will still exist.win.close();

destroy

// main.js// Close a specific window and free all memory resources.win.destroy();

run

// main.js// Run JavaScript without waiting for the response.win.run(`alert("hello world.");`);

bind

// main.js// Bind a specific html element click event with a function. Empty element means all events.letbindId=win.bind("domID",(e)=>{console.log(e.bindId);//console.log(e.windowId);console.log(e.elementId);// "domID"console.log(e.eventNumber);// increased when event occur// 0: Window disconnection event// 1: Window connection event// 2: Mouse click event// 3: Window navigation event// 4: Function call eventconsole.log(e.eventType);//});

global

QuickJs doesn't have console.log but QuickUI do.

//main.jsconsole.log("hello world!");webui.setTimeout(0);//set wait forever.webui.wait();//now wait forever.

os

QuickJs sets the setTimeout and setInterval methods inside the os module.

setTimeout

//main.jsimport*asosfrom"os";os.setTimeout(()=>{console.log("time out");},1000);webui.setTimeout(0);//set wait forever.webui.wait();//now wait forever.

setInterval

//main.jsimport*asosfrom"os";os.setInterval(()=>{console.log("interval");},1000);webui.setTimeout(0);//set wait forever.webui.wait();//now wait forever.

TypeScript Support

The Declaration File :

About

A GUI framework based on QuickJs and WebUI

Resources

Stars

46 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages