Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Electron coding specification


May 25, 2021 Electron


Table of contents


The following is the coding specification for the Electron project.

C and Python

We follow Chromium's coding specifications for C and Python. Y ou can use script/cpplint.py verify that the document meets the requirements.

The Pyhton version we are currently using is Python 2.7.

Many of the interfaces and data types in Chromium are used in the code, so I hope you're familiar with them. T he Important Interfaces and Data Structures in Chromium is a good getting started document that mentions special types, in-domain types (automatically freeing memory when exiting scope), logging mechanisms, and so on.

CoffeeScript

For CoffeeScript, we follow GitHub's coding specifications and the following rules:

  • File Don't end with a line break, we'll follow Google's coding guidelines.
  • The file name uses - - _ to connect words, such as file-name.coffee file_name.coffee which follows the name of the github/atom module-name This rule applies only .coffee files.

API naming

When creating a new API, we prefer to use getters and setters instead of jQuery single-function naming, such as .getText() and .setText(text) .text([text])