What's the diffrence between CEF and Electron?
Is there anyone can tell us what is the diffrence between CEF and Electron?
And about Electron, since Electron is based on chromium, why use NodeJS instead of directly using the V8 engine in chromium
Answering the second question - NodeJs supplements Chromium engine, not substitutes it in Electron. Please go through this great article to get an idea of process communication within the framework. In a nutshell - there are 2 major players over there:
- Main (or "host") process - running on NodeJs with access to OS functionality, responsible for windows orchestration and providing access to native functions
- Renderer process - actual Chromium instance with additional bindings allowing to "speak" to Main process
On differences between the frameworks - this is a broad question, in general they cover the same needs and most of differences are on tech side:
- Dev Tooling (Dev Language, APIs, SDKs, testing frameworks)
- Supported platforms
- Packaging and distribution options
- Performance and memory management
- Dev community adoption
- tbc
There is no clear "winner" or "looser" over there. Each of items above (and some on top) require additional research, keeping in mind your user base, dev team experience with relevant tech stack, application complexity, etc
CEF
CEF is one of the first solutions that wrapped Chromium functionality and provided an API that can be used by third-party applications. Chromium is a standalone desktop application. CEF represents it as a framework. Since Chromium is written using C++, CEF represents a framework for C++ developers, but there are many ports for Java, .NET, and Python languages.
The main purpose of CEF is to let C++ developers embed Chromium into their C++ cross-desktop application and access Chromium features like rendering (including off-screen), DOM, V8, PDF Viewer, Printing, Network requests/responses, cookies, etc.
The examples of such applications are Steam, Spotify, Adoby Brakets, and more.
Electron
Taking into account that CEF and Electron source codes are very similar, I can assume that:
Electron == CEF + Node.js
The main purpose of Electron is to let JavaScript developers build cross-platform desktop applications on top of Chromium. Each window in Electron app represents a Chromium window that renders specific web page or HTML. The GUI of Electron apps is built using HTML, CSS, and JavaScript. The logic (backend) is written using Node.js.
Which one to use?
CEF is for you if you are a C++ developer. It allows you both embedding Chromium into an existing C++ desktop application and creating Electron C++ cross-desktop applications.
Electron is for you if you are a JavaScript developer who wants to create a cross-desktop application with HTML, CSS, JavaScript GUI and you don't want to learn more efficient technologies and frameworks such as Qt, Gtk, Cocoa, Java Swing/JavaFX/SWT, Flutter, etc.