pas2js Electron Web Application: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: pas2js Electron Web Application
| Old | New | Line | |
|---|---|---|---|
| 1 | + | # Electron Web Application | |
| 2 | + | ||
| 3 | + | Since Lazarus 2.3 and pas2js 2.2.1. | |
| 4 | + | ||
| 5 | + | # Install Electron | |
| 6 | + | ||
| 7 | + | First you must install **node.js**. | |
| 8 | + | ||
| 9 | + | - Windows, MacOS: <https://nodejs.org/en/download/> | |
| 10 | + | - Debian, Ubuntu: | |
| 11 | + | ||
| 12 | + | `sudo apt install nodejs npm` | |
| 13 | + | ||
| 14 | + | Check that node and npm work: | |
| 15 | + | ||
| 16 | + | `node -v`\ | |
| 17 | + | `npm -v` | |
| 18 | + | ||
| 19 | + | Create some directory and install electron there: | |
| 20 | + | ||
| 21 | + | `mkdir mynodejs`\ | |
| 22 | + | `cd mynodejs`\ | |
| 23 | + | `npm install --save-dev electron` | |
| 24 | + | ||
| 25 | + | This should create a sub folder *node_modules* containing electron: | |
| 26 | + | ||
| 27 | + | `C:\Whatever\mynodejs\node_modules\electron\dist\electron.exe` | |
| 28 | + | ||
| 29 | + | Set the full path to this executable in *Lazarus Tools / Options / pas2js / Electron executable* | |
| 30 | + | ||
| 31 | + | # Lazarus Electron Web Application | |
| 32 | + | ||
| 33 | + | Install pas2jsdgn package. For more information see [[lazarus pas2js integration|here]]. | |
| 34 | + | ||
| 35 | + | You get a new project type **Electron Web Application**, which is like a *Web Browser Application*, except this wizard creates three projects, the **preload.lpi**, the **render.lpi** and **YourApp.lpi**, and a project group. | |
| 36 | + | ||
| 37 | + | After the options dialog it asks for the file name of the webapp program source filename (usually a *.lpr or *.pas). Choose some name, you can later rename it. | |
| 38 | + | ||
| 39 | + | To run it you must compile all three projects to create the three needed js files. The project group window helps you to switch easily and compile all projects. | |
| 40 | + | ||
| 41 | + | --- | |
| 42 | + | *From the Free Pascal wiki, page "pas2js Electron Web Application", as it stood on 2022-08-16 after a change by Skalogryz, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).* | |
| 43 | + | Category: Applications created with Lazarus |
