pas2js Electron Web Application: what changed
Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.
| Old | New | Line | |
|---|---|---|---|
| 1 | 1 | # Electron Web Application | |
| 2 | 2 | ||
| 3 | 3 | Since Lazarus 2.3 and pas2js 2.2.1. | |
| 4 | 4 | ||
| 5 | 5 | # Install Electron | |
| 6 | 6 | ||
| 7 | 7 | First you must install **node.js**. | |
| 8 | 8 | ||
| 9 | 9 | - Windows, MacOS: <https://nodejs.org/en/download/> | |
| 10 | 10 | - Debian, Ubuntu: | |
| 11 | 11 | ||
| 12 | - | ||
| 12 | + | ```text | |
| 13 | + | sudo apt install nodejs npm | |
| 14 | + | ``` | |
| 13 | 15 | ||
| 14 | 16 | Check that node and npm work: | |
| 15 | 17 | ||
| 16 | - | ||
| 17 | - | ||
| 18 | + | ```text | |
| 19 | + | node -v | |
| 20 | + | npm -v | |
| 21 | + | ``` | |
| 18 | 22 | ||
| 19 | 23 | Create some directory and install electron there: | |
| 20 | 24 | ||
| 21 | - | ||
| 22 | - | ||
| 23 | - | ||
| 25 | + | ```text | |
| 26 | + | mkdir mynodejs | |
| 27 | + | cd mynodejs | |
| 28 | + | npm install --save-dev electron | |
| 29 | + | ``` | |
| 24 | 30 | ||
| 25 | 31 | This should create a sub folder *node_modules* containing electron: | |
| 26 | 32 | ||
| 27 | - | ||
| 33 | + | ```text | |
| 34 | + | C:\Whatever\mynodejs\node_modules\electron\dist\electron.exe | |
| 35 | + | ``` | |
| 28 | 36 | ||
| 29 | 37 | Set the full path to this executable in *Lazarus Tools / Options / pas2js / Electron executable* | |
| 30 | 38 | ||
| 31 | 39 | # Lazarus Electron Web Application | |
| 32 | 40 | ||
| 33 | 41 | Install pas2jsdgn package. For more information see [[lazarus pas2js integration|here]]. | |
| 34 | 42 | ||
| 35 | 43 | 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 | 44 | ||
| 37 | 45 | 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 | 46 | ||
| 39 | 47 | 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 | 48 | ||
| 41 | 49 | --- | |
| 42 | 50 | *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 | 51 | Category: Applications created with Lazarus |
