Extended system
The Cocos Creator editor is based on the Electron kernel. Electron is a cross-platform development framework that integrates Node.js and Chromium.
In Electron’s architecture, an application consists of a main process and a rendering process. The main process is responsible for managing platform-related scheduling, such as opening and closing windows, menu options, basic dialog boxes, and so on. Each newly opened window is an independent rendering process. In Electron, each process independently enjoys its own JavaScript content and cannot directly access each other. When you need to transfer data between processes, you need to use inter-process communication (IPC). Related functions can be read in the to have a deeper understanding of the main process and rendering process in Electron relationship. To put it simply, the main process of Electron is equivalent to a Node.js server program, and each window (rendering process) is equivalent to a client web program.
As previously mentioned, the JavaScript content between the two processes is independent of each other, and data must be exchanged by means of inter-process communication. Inter-process communication is actually the process of sending messages in one process, and then listening for messages in another process. Electron provides modules ipcMain and ipcRenderer corresponding to inter-process communication to help us accomplish this task. Since these two modules only complete very basic communication functions, and cannot meet the communication requirements between the editor, the expansion panel and the main process, Cocos Creator has been encapsulated on top of this, and the inter-process messaging is expanded. The method is convenient for extension developers and editor developers to create more complex scenarios. For more instructions, please see the Message documentation.
Extended Ability
The extension has a complete nodejs environment, which makes it easy to use a large number of tools on the npm market. Used to complete the function you want.
In addition, you can also use some tools to facilitate the development of extensions, such as:
The extension only agrees to the entrance, during which a large number of external libraries can be used to optimize the development process.