Electron project : open index.html or npm start, what changes? - javascript

When I run npm start, it opens a GUI electron and it works fine.
On the other hand, When I open index.html, it opens chrome and it seems that not all sources are loaded.
What is the difference ?

Electron provides a host of APIs and a Node.js backend that you don't get if you open an HTML document in a regular browser.

Related

How do I set up Visual Studio Code and my browser side by side

Just starting out using Visual Studio Code. I can have the browser in a preview, but I want to have the browser linked instead.
I'm using a Mac.
I tried dragging the new browser page next, but that does not work as they do not connect.
What else can I do?
I am guessing you mean you want your browser side by side next to the VSCode app. You can copy the absolute file path(I think it is just called 'Copy Path') of the html file and paste the path in the browser.
Or you can do as Andre Sampaio said and download Live Server extension on VSCode. The extension updates your codes in the browser every time you save in VSCode. After you download the extension through the extension tab in VSCode, you right-click(or control + click) and click 'Open with Live Server' in the HTML file.
Another solution for Live-Server
Go to https://nodejs.org/en/ and download Node.js for your Mac
Go to VSCode and press 'Control + ~` and it will open up the terminal inside VSCode
Type in sudo npm install live-server -g
Enter your password
Type in live-server in Terminal and the file should pop up on the browser
In the future, all you have to do is type in live-server in VSCode's Terminal. The node won't disappear unless you kill the active Terminal instance by clicking on the trash can in VSCode's Terminal

Can I manually download Tauri buiding dependencies?

Due to some reasons, my host matchine can not get access to the Internet, the only way to build the app is to manually download all dependecies on another disk.
However, I was stuck in the wix package, which is downloaded from github. I've successfully downloaded it from my browser, but I don't know where to place it.
Is there any way to manually download all dependencies?
I was stuck here (on another disk):
info: Running Loopback command
Compiling app v0.1.0 (D:\frontend\src-tauri)
Compiling tauri v0.6.0
Finished release [optimized] target(s) in 19.28s
info: Verifying wix package
info: Downloading https://github.com/wixtoolset/wix3/releases/download/wix3112rtm/wix311-binaries.zip
On a windows machine, you can put the contents of https://github.com/wixtoolset/wix3/releases/download/wix3112rtm/wix311-binaries.zip in %LOCALAPPDATA%/tauri/WixTools.

Can not run index.html in oracle Jet application using templates

I am new to Oracle Jet. Now I want to use NetBeans to create a simple application with pre-defined templates downloaded from http://www.oracle.com/technetwork/developer-tools/jet/downloads/index.html.
The creation steps are:
file - new project - Categories (HTML5/JavaScript) and Projects (HTML5/JS Application) -select the template - Jet-Template Web Basic.zip.
But when I open index.html under Site Root in this application, the "Run" tab is not available. Also there is no "run" when right click on index.html.
I tried all other templates in the download page but none of them can work.
Do you have an idea on this?
IDE version: NetBeans 8.1
Not sure why that happens. Might be a bug...
2 work-arounds:
Right-click on the project under the Projects tab. You'll notice the Run function is enabled here.
(Better option) Extract the zip contents, choose 'Open Project' in Netbeans and navigate to the extracted folder. You'll notice that the Run function is available for index.html if you open the project this way.

Node-webkit app talk to terminal

Is it possible for me to write html/css/javascript to have a button that'll open up the terminal program on my computer and run some scripts?
The scenario I want is:
On my ubuntu laptop, run my node-webkit app, click a button on the screen, a terminal opens, and start executing some scripts.
Thanks
from web page you cant do this but you can use node.js , if you want to make a GUI app with JavaScript you can use node-webkit with it you can build cross platform software that can work with Linux and execute commands in the terminal
You can do this from a webpage, but make sure your hosts.allow (or equivalent) is set to localhost only. Just run any web server with cgi capability and drop in your cgi script that runs your scripts into the cgi-bin directory. Then just add an empty form submit button or link to localhost:8080/cgi-bin/your_script
Slitaz uses this for their entire configuration system using busybox httpd and shell scripts, but uses shell generated interactive forms instead of a terminal. See: http://hg.slitaz.org/tazpanel/file/
Another way to do it without a web server (at least with firefox/seamonkey - not tried with chrom) is to associate a file extension so that files with that extension are opened with that script. Then just make a link to an empty file with that extension.
Use child_process module:
<script>
var cp = require('child_process');
function run() {
cp.exec('gnome-terminal -x bash -c "./your_script.sh; read -n1"');
}
</script>
<button onclick="run()">your_script.sh</button>
You can also remove read -n1 and simply run
cp.exec('gnome-terminal -x ./your_script.sh');
in case you don't want to wait for any key press.

How to have Grunt launch a packaged Chrome App

I've used the [yeoman chromeapp generator][1] to scaffold out a Google Chrome Packaged App. The instructions for that generator say running the command grunt debug should launch the packaged app in the Chrome App container, but it doesn't. Instead it opens the packaged app as a regular hosted web app in a tab. Though I am a Grunt noob I'm looking at Gruntfile.js trying to figure out why it doesn't launch the app as a packaged app in the app container, but can't see where the problem is. What's the proper way to get Grunt to launch a Chrome App?
Had the same issue with the Yeoman live-reload—not great for testing actual apps with background js, native permissions, etc.
To manually launch a Chrome app from a folder, I've been using this idiom: ~/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --load-and-launch-app=/path/to/chrome/app/"
There's also this project chrome-app-livereload (blog post) which supposedly swaps out livereload's standard reload with one suitable for inclusion in an app.
You have to go to chrome://extensions, check the box Developer Mode and then click Load Unpacked Extension and point it to your manifest file. This will load your app in a Chrome App Container.

Categories

Resources