How to run a SB-WebApp as a Desktop-Application
Posted: Sun Feb 11, 2018 12:23 pm
Hello,
here is a tip how to run a SpiderBasic-WebApp as an application on the desktop (Windows, Linux, MacOS):
Getting Started:
Download NW.js (https://nwjs.io/) and unpack it at a location of your choice.
Create a new folder named "www" in the unzipped folder.
Create a file called "app.js" in the main folder with the following content:
Also in the main folder create a file named "package.json" with the following content:
Create a new file in SpiderBasic:
Then select Compiler -> Create App -> Call Web from the menu bar.
Enter the following values:
App Name: HelloWorld
HTML filename: [pathtoyourNwJsfolder]/wwww/index. html
JavaScript filename: HelloWorld. js
Check "Copy SpiderBasic library" and "Enable debugger".
Press "Create App".
Then change to the NwJs folder and start the executable file there:
SpiderBasic NwJs - Modules:
NW.js is easy to control from SpiderBasic. For this I have written some JavaScript wrappers in form of modules, which can be downloaded here: https://github.com/spiderbytes/NwJs
For example, if you want to resize the window, you can bind the NwJsWin.sbi module and call NwJsWin::ResizeTo() with the corresponding values.
Since NW.js has a' built-in' NodeJS, you can also use appropriate commands (such as those of the filesystem) to communicate from SpiderBasic with the 'outside world' (SpiderBasic modules NwJsOs, NwJsFs, NwJsClipboard).
Just give it a try.
Have fun... Peter
here is a tip how to run a SpiderBasic-WebApp as an application on the desktop (Windows, Linux, MacOS):
Getting Started:
Download NW.js (https://nwjs.io/) and unpack it at a location of your choice.
Create a new folder named "www" in the unzipped folder.
Create a file called "app.js" in the main folder with the following content:
Code: Select all
var win = nw.Window.open('./www/index.html', {
position: 'center',
width: 1000,
height: 800,
focus: true
});
Code: Select all
{
"name": "HelloWorld",
"main": "app.js"
}
Code: Select all
Debug "HelloWorld!"
Enter the following values:
App Name: HelloWorld
HTML filename: [pathtoyourNwJsfolder]/wwww/index. html
JavaScript filename: HelloWorld. js
Check "Copy SpiderBasic library" and "Enable debugger".
Press "Create App".
Then change to the NwJs folder and start the executable file there:
SpiderBasic NwJs - Modules:
NW.js is easy to control from SpiderBasic. For this I have written some JavaScript wrappers in form of modules, which can be downloaded here: https://github.com/spiderbytes/NwJs
For example, if you want to resize the window, you can bind the NwJsWin.sbi module and call NwJsWin::ResizeTo() with the corresponding values.
Since NW.js has a' built-in' NodeJS, you can also use appropriate commands (such as those of the filesystem) to communicate from SpiderBasic with the 'outside world' (SpiderBasic modules NwJsOs, NwJsFs, NwJsClipboard).
Just give it a try.
Have fun... Peter