GithubHelp home page GithubHelp logo

electron-native's Introduction

Electron Native Project Example

This is an example of an Electron project that uses Native Node Addons written in C++. It's a simple calculator that asynchronously adds two numbers and returns a promise to return the result. In the native code, it uses the uv_work APIs to schedule a work item on the work queue and inject the results into the main event loop to return it to the JavaScript world.

On the Electron side, this module is require'd by both the main process, that prints the results on the console, and the renderer process which injects the results into the page.

We're using CMake here because it's just a better build system than node-gyp and we're planning on using libraries that have CMake fragments. To fit it nicely into the npm build script, I've written a simple cmake.js node script that emulates what CDT does, by running CMake only the first time and allowing the builder to run it again as necessary.

Also, this is a bit of an introduction to C++11 for me. I'm using healthy doses of auto typing and we send lambda's to the work queue. It makes the code much easier to read and understand.

electron-native's People

Contributors

dschaefer avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

arlenyan

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.