Convert Figma logo to code with AI

electron logoelectron-api-demos

Explore the Electron APIs

10,248
2,116
10,248
48

Top Related Projects

Clone to try a simple Electron app

Make any web page a desktop application

6,405

:electron: A complete tool for building and publishing Electron applications

7,402

:electron: 🚀 The easiest way to get started with Electron

Quick Overview

Electron API Demos is an interactive application that demonstrates the core features of the Electron framework. It provides hands-on examples of how to use various Electron APIs, making it an excellent learning resource for developers who want to build cross-platform desktop applications using web technologies.

Pros

  • Comprehensive coverage of Electron APIs
  • Interactive and user-friendly interface
  • Regularly updated to reflect the latest Electron features
  • Includes source code for each demo, allowing developers to learn by example

Cons

  • May not cover some advanced or niche Electron features
  • Requires basic knowledge of web technologies to fully understand the demos
  • Some examples might become outdated if not maintained regularly
  • Limited to demonstrating Electron-specific features, not general app development practices

Getting Started

To run the Electron API Demos application:

  1. Clone the repository:

    git clone https://github.com/electron/electron-api-demos.git
    
  2. Navigate to the project directory:

    cd electron-api-demos
    
  3. Install dependencies:

    npm install
    
  4. Start the application:

    npm start
    

The application will launch, allowing you to explore various Electron API demos interactively.

Competitor Comparisons

Clone to try a simple Electron app

Pros of electron-quick-start

  • Simpler and more lightweight, ideal for beginners
  • Faster setup and easier to understand the basic structure
  • Focuses on core Electron concepts without additional complexities

Cons of electron-quick-start

  • Limited functionality and features compared to the API demos
  • Lacks comprehensive examples of Electron's capabilities
  • May require more research and coding to implement advanced features

Code Comparison

electron-quick-start:

const { app, BrowserWindow } = require('electron')

function createWindow () {
  const win = new BrowserWindow({ width: 800, height: 600 })
  win.loadFile('index.html')
}

app.whenReady().then(createWindow)

electron-api-demos:

const path = require('path')
const glob = require('glob')
const electron = require('electron')

const BrowserWindow = electron.BrowserWindow
const app = electron.app

const debug = /--debug/.test(process.argv[2])

if (process.mas) app.setName('Electron APIs')

The electron-quick-start code is more straightforward, focusing on creating a basic window. In contrast, electron-api-demos includes additional modules and configuration options, preparing for a more complex application with various API demonstrations.

Make any web page a desktop application

Pros of Nativefier

  • Simplifies the process of creating desktop applications from web apps
  • Supports a wide range of customization options for the generated apps
  • Allows for easy packaging and distribution of web-based applications

Cons of Nativefier

  • Limited control over the underlying Electron framework
  • May not provide access to all native OS features
  • Generated apps can be larger in size compared to custom-built Electron apps

Code Comparison

Electron-api-demos (main process):

const { app, BrowserWindow } = require('electron')

function createWindow () {
  const win = new BrowserWindow({ width: 800, height: 600 })
  win.loadFile('index.html')
}

app.whenReady().then(createWindow)

Nativefier (CLI usage):

nativefier --name "My App" --icon icon.png "https://mywebapp.com"

Summary

Electron-api-demos is designed to showcase Electron's capabilities and provide examples for developers building custom Electron applications. It offers more flexibility and control over the application's behavior and features.

Nativefier, on the other hand, is a tool that simplifies the process of creating desktop applications from existing web applications. It's more user-friendly for those who want to quickly convert web apps to desktop apps without diving deep into Electron development.

While Electron-api-demos requires more coding knowledge, it allows for greater customization and optimization. Nativefier trades some of this control for ease of use and rapid development.

6,405

:electron: A complete tool for building and publishing Electron applications

Pros of Forge

  • Comprehensive project scaffolding and build tooling
  • Simplified distribution and packaging process
  • Extensive configuration options for customizing builds

Cons of Forge

  • Steeper learning curve for beginners
  • May be overkill for simple applications
  • Less focus on API demonstrations and examples

Code Comparison

Electron API Demos (main.js):

const { app, BrowserWindow } = require('electron')

function createWindow () {
  const win = new BrowserWindow({ width: 800, height: 600 })
  win.loadFile('index.html')
}

app.whenReady().then(createWindow)

Forge (forge.config.js):

module.exports = {
  packagerConfig: {},
  makers: [
    {
      name: '@electron-forge/maker-squirrel',
      config: { name: 'MyApp' }
    }
  ]
}

Summary

Electron API Demos is focused on showcasing Electron's capabilities through interactive examples, making it ideal for learning and exploring the framework. Forge, on the other hand, is a powerful tool for building and distributing Electron applications, offering a more production-ready environment. While API Demos is more beginner-friendly and demonstration-oriented, Forge provides a robust set of tools for developing and packaging complete applications, albeit with a steeper learning curve.

7,402

:electron: 🚀 The easiest way to get started with Electron

Pros of Fiddle

  • Interactive playground for experimenting with Electron code
  • Ability to save, share, and run Electron experiments easily
  • Integrated package management and version control

Cons of Fiddle

  • Less structured learning experience compared to API Demos
  • May be overwhelming for complete beginners
  • Focuses more on code experimentation than guided tutorials

Code Comparison

Electron API Demos typically showcases specific API usage:

const { app, BrowserWindow } = require('electron')

function createWindow () {
  const win = new BrowserWindow({ width: 800, height: 600 })
  win.loadFile('index.html')
}

app.whenReady().then(createWindow)

Fiddle allows for more flexible experimentation:

const { app, BrowserWindow } = require('electron')

app.whenReady().then(() => {
  const win = new BrowserWindow({ width: 800, height: 600 })
  win.loadURL('https://example.com')
})

Both repositories serve different purposes within the Electron ecosystem. API Demos provides a structured introduction to Electron's features, while Fiddle offers a sandbox for experienced developers to experiment and prototype. API Demos is better suited for beginners looking to learn about Electron's capabilities, whereas Fiddle caters to developers who want to quickly test ideas or troubleshoot issues.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Electron API Demos icon Electron API Demos

Build Status JavaScript Standard Style

This is a desktop app that interactively and with sample code demonstrates core features of the Electron API. It's built with Electron, too, of course. This app works on Windows, macOS and Linux operating systems.

Use this app to see what you can do with Electron and use the source code to learn how to create a basic Electron app.

Electron API Demos Screenshots


This project adheres to the Contributor Covenant code of conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to coc@electronjs.org.

Follow @ElectronJS on Twitter for important announcements. Visit the electron website.

Using

You can download the latest release for your operating system or build it yourself (see below).

Building

You'll need Node.js installed on your computer in order to build this app.

$ git clone https://github.com/electron/electron-api-demos
$ cd electron-api-demos
$ npm install
$ npm start

If you don't wish to clone, you can download the source code.

For easier developing you can launch the app in fullscreen with DevTools open:

$ npm run dev

Extending

Read the docs to learn more about how this app is built or how to add a new demo.

Translations

Note: these versions are maintained by outside contributors and may not always be in sync with this version.