GithubHelp home page GithubHelp logo

tchigher / muon Goto Github PK

View Code? Open in Web Editor NEW

This project forked from imvexed/muon

0.0 0.0 0.0 69.55 MB

GPU based Electron on a diet

License: MIT License

Go 54.86% C++ 5.02% Objective-C 9.17% C 30.94%

muon's Introduction

gnet

GitHub code size in bytes


Muon is a lightweight alternative to Electron written in Golang in about ~300 LoC, using Ultralight instead of Chromium. Ultralight is a cross-platform WebKit rewrite using the GPU to target embedded desktop applications that resulted in a fast, lightweight, and low-memory HTML UI solution that blends the power of Chromium with the small footprint of Native UI.

Features

  • Full JS to Go interop
  • GPU based rendering
  • Cross-platform
  • Hot-reloading
  • Superior disk size + memory & cpu usage

Comparison with a "Hello, World!" React App

Muon Electron
CPU 0.0% 1.2%
MEM 26.0 MB 201.7 MB
DISK 42 MB 136 MB

Example

From examples/create-react-app/main.go:

package main

import (
  "github.com/ImVexed/muon"

  "cra-go/webfiles"
  "net/http"
)

func main() {
  // Any static asset packer of your liking (ex. fileb0x)
  fileHandler := http.FileServer(webfiles.HTTP)

  cfg := &muon.Config{
    Title:      "Hello, World!",
    Height:     500,
    Width:      500,
    Titled:     true,
    Resizeable: true,
  }

  m := muon.New(cfg, fileHandler)

  // Expose our `add` function to the JS runtime
  m.Bind("add", add)

  // Show the Window and start the Runtime
  if err := m.Start(); err != nil {
    panic(err)
  }
}

// Muon automatically handles interop to and from the JS runtime
func add(a float64, b float64) float64 {
  return a + b
}

FAQ

Q: How are JS types translated to Go types?

  • JS: Boolean Go: bool
  • JS: Number Go: float64
  • JS: String Go: string
  • JS: Object Go: struct via JSON

Q: I get exit status 3221225781 when I try to run my program

  • Your program likely can't find the Ultralight libraries. Ensure they're either installed on the system, or, in the same folder as your program. Currently, Muon uses the 1.1 Ultralight pre-release that hasn't yet propagated to their main site and can only be downloaded from the Ultralight github repo.

Q: How do I get rid of the Console window on Windows?

  • Add -ldflags -H=windowsgui to either your go build or go run to get rid of the window.

Q: How do I setup Ultralight?

Q: Is there perfect Chrome or Firefox feature parity?

Licensing

While muon itself is MIT licensed, Ultralight is not.

Ultralight is free for non-commercial use, educational use, 
and also free for commercial use by small indie developers making
less than US$100,000 a year. You can find full terms in the SDK. 
Pricing plans for larger commercial projects will be announced later.

Their specific license terms can be found here.

muon's People

Contributors

0xflotus avatar dags- avatar imvexed avatar puckzxz avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.