CN110275700A - A kind of cross-platform multipad Development Framework and method based on electron - Google Patents

A kind of cross-platform multipad Development Framework and method based on electron Download PDF

Info

Publication number
CN110275700A
CN110275700A CN201910520250.0A CN201910520250A CN110275700A CN 110275700 A CN110275700 A CN 110275700A CN 201910520250 A CN201910520250 A CN 201910520250A CN 110275700 A CN110275700 A CN 110275700A
Authority
CN
China
Prior art keywords
module
submodule
controller
process module
development framework
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201910520250.0A
Other languages
Chinese (zh)
Inventor
阎朝坤
王建林
狄雨晨
罗慧敏
张戈
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Henan University
Original Assignee
Henan University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Henan University filed Critical Henan University
Priority to CN201910520250.0A priority Critical patent/CN110275700A/en
Publication of CN110275700A publication Critical patent/CN110275700A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/20Software design
    • G06F8/22Procedural

Abstract

The present invention provides a kind of cross-platform multipad Development Framework and method based on electron.The frame: common component module, scheduler module, framework services module and MVC example module;The common component inside modules are integrated with routing submodule, configuration submodule and log submodule;The scheduler module includes host process module and rendering scheduler module, and the host process module and rendering scheduler module, which extend, assisted process module, respectively host process assisted process module and rendering process assisted process module;The framework services module includes file system service submodule, Http request and answer service submodule, messaging service submodule, state machine service submodule and Attendant sub-module is locally stored.This method includes the application method and operation method of Development Framework.The present invention can allow developer to be preferably absorbed in business realizing using the characteristic of electron, without paying close attention to technical detail, improve the development efficiency of multipad developer.

Description

A kind of cross-platform multipad Development Framework and method based on electron
Technical field
The present invention relates to computer software technical field more particularly to a kind of cross-platform desktop applications based on electron Program development frame and method.
Background technique
According to the difference of language, the Development Framework of mainstream conventional desktop application program can be divided into following several:
(1) the cross-platform multipad Development Framework based on Java.
Using Java Swing as the Java forms multipad of representative.Since Java is cross-platform, Java The application that Swing technological development comes out is also cross-platform, but the interface write of this technology depends on the statement of developer, and Can not What You See Is What You Get well exploitation, and interface UI element is old, influences User Exploitation efficiency.Meanwhile Java The operation of Swing program needs to rely on Java context.
(2) the Windows system desktop application development frameworks based on C#
The multipad frame of C# language exploitation mainly includes WinForm and WPF, and wherein WinForm has been discarded substantially, WPF provides preferable user experience, and the function of most multipads can be realized in conjunction with C#, but the operation of C# It must be based on .NET Frameworker platform, mainstream technology cross-platform can not be passed through.
(3) multipad using C/C++/Python language development based on QT
It for C and C++, has the disadvantage in that the development cycle is long using the application program of both language developments, it is multiple to write grammer Miscellaneous, compilation time is long.And consider cross-platform effect, the function library that must just Cross Platform Technology is used to support increases exploitation The learning cost of person.
It is mainstream speech and can be cross-platform for Python, the QT application that Python writes can be cross-platform.But It is the QT program write by Python, first, the grammer of the statement formula similar to Java, can not provide the volume of What You See Is What You Get Journey experience;Second, the interface user UI and background logic are bound by force, it is meant that before making when background process long-time task The interface platform UI loses response.
Summary of the invention
Development cost existing for Development Framework for conventional desktop application is high, the period is long, language is strong by platform constraints And cross-platform compatibility it is poor the problems such as, the present invention provide it is a kind of based on electron cross-platform multipad exploitation frame Frame and method propose the Quick Development Framework using Node.js, and developer is allowed preferably to utilize electron's Characteristic is absorbed in business realizing, without paying close attention to technical detail.
In a first aspect, the present invention provides a kind of cross-platform multipad Development Framework based on electron, this is opened Sending out frame includes: common component module, scheduler module, framework services module and MVC example module;In the common component module Portion is integrated with routing submodule, configuration submodule and log submodule;The scheduler module include host process module and render into Journey module, the host process module and rendering scheduler module, which extend, assisted process module, respectively host process assisted process Module and rendering process assisted process module;The framework services module include file system service submodule, Http request with Answer service submodule, messaging service submodule, state machine service submodule and Attendant sub-module is locally stored;
The routing submodule, for saving routing parameter, opening new view and obtaining routing parameter;
The configuration submodule, for being based on global configuration item appconfig.json file acquisition key-value pair configuration item;
The log submodule, is divided into the log of multiple ranks, calls on demand for developer;
The host process assisted process module, for safeguarding IPC channel when electron starts main.js;
The rendering process assisted process module is for creating MVC example, and leading to host process module in trustship MVC example Letter;
The file system service submodule, for by calling fs module and child_process module built in Node.js To handle file and execute command line instructions;
Http request is defaulted as by the Http request and answer service submodule using lightweight network communication library unirest Post request, and the Content-Type and Accept that configure header are application/json;
The messaging service submodule, for prompting the service of common message notice and mistake/unexpected message notice service;
The state machine service submodule, for storing global state machine variable, after application initialization, host process mould Block and/or assisted process module safeguard global state by calling the state machine service submodule;
It is described that Attendant sub-module is locally stored, for saving key-value pair data by localStorage object;
The MVC example module, for storing the MVC example of rendering process assisted process module creation.
Further, the host process assisted process module, is also used to: by binding preparation event, explaining from the top down The script of the host process assisted process module.
Further, the host process module and/or assisted process module are by calling the state machine service submodule To safeguard global state specifically:
If host process module calls global state machine, called by global mode;
If assisted process module calls global state machine, called by remote object mode.
Second aspect, the embodiment of the present invention provide a kind of cross-platform multipad Development Framework based on electron Application method, comprising:
Step 1: the exploitation environment and rely on management tool that installation Development Framework relies on, and dispose corresponding Development Framework code;
Step 2: the packet management tool of the build tool being installed, and is relied on needed for the dependence library downloading according to Development Framework configuration;
Step 3: modification Development Framework configuration item is to be applicable in business scenario;
Step 4: the service logic according to Development Framework rule for the business scenario writes code;
Step 5: completing debugging using the build tool and be packaged.
Further, the step 3 specifically:
Development Framework head view configuration item is revised as application program entry view name in Development Framework configuration file, and is added Required custom parameter.
Further, the step 4 specifically:
Step 4.1: writing view code using html grammer in view file and introduce control corresponding with view name Device file;
Step 4.2: code logic is write in controller file, using Node.js grammer and mixes other front end frames, it is described Other front end frames include jQuery;
Step 4.3: drawing call common component module interface, scheduler module interface and framework services module interface on demand;
Step 4.4: the new view approach of opening of calling base class controller after base class controller is introduced in controller file, it is described It opens new view approach and is used to indicate the new view of routing submodule load;
Step 4.5: the acquisition window parameter method of base class controller being called to receive routing parameter in new view.
Further, the step 4.4 specifically includes:
Step 4.4.1: the base class controller of Development Framework is introduced or inherited in controller code;
Step 4.4.2: calling the new view approach of opening of base class controller in controller code, described to open new view approach Route signal amount is sent to host process assisted process by IPC mechanism;
Step 4.4.3: host process assisted process module receives and routing parameter is stored in global buffer after semaphore;
Step 4.4.4: host process assisted process module calls the resource loading method load of global browser window object instance New view;
Step 4.4.5: the base class controller of Development Framework is introduced or inherited in the corresponding controller code of new view;
Step 4.4.6: call the acquisition window parameter method of base class controller to obtain in the corresponding controller code of new view Take the routing parameter of transmitting.
Further, it completes to be packaged using the build tool in the step 5 specifically:
Packaging operation is carried out using the instruction of the packet management tool, and generates the installation procedure of corresponding platform.
The third aspect, the embodiment of the present invention provide a kind of cross-platform multipad Development Framework based on electron Operation method, comprising:
Step 1: the application program launching stage: starting main.js using electron, utilize host process assisted process module creation Window object example, and view file is loaded, controller is introduced by the src attribute of script label;
The step 2:MVC example operation phase: after application program launching, rendering kernel is looked for by the src attribute of script label To controller, controller code is loaded onto memory, on-demand invocation framenort service module and/or common component module;
Step 3: routing jump method when controller code triggers in the process of running, then execute routing and pass ginseng process to open New view.
Further, the execution routing and biography ginseng process specifically:
During former view, rendering process assisted process module will be routed by the public global buffer of remote object invocation Parameter is stored in the public global buffer;Using rendering process assisted process module IPC object send route signal to The IPC object of host process assisted process module, the IPC object of host process assisted process call window object example after receiving signal Resource loading method, the resource loading method is used to load and the corresponding view of view name of host process module transmission Figure, former view process finish;Wherein, the public global buffer is stated in advance by host process assisted process module;
During new view, controller calls the window parameter method that obtains, and the acquisition window parameter method is used for by remote Journey object acquisition is stored in the routing parameter in the public global buffer.
Beneficial effects of the present invention:
A kind of cross-platform multipad Development Framework and method based on electron provided by the invention has with following Beneficial effect:
(1) reduce learning cost: Development Framework of the present invention directly draws interface using html technology, controls pattern with Css, Realize that the technology stack of function and web front end exploitation is completely the same with Js, html technology can not only be used to develop web program, but also Multipad can be developed, reduce the learning cost of developer.
(2) cross-platform compatibility is good: Development Framework of the present invention is to be designed based on electron, and electron is It is developed based on Chrome Mini kernel, the multi-process application program constructed using Node.js technology, therefore the present invention develops frame Frame has cross-platform compatibility good.
(3) integrate multipage application: Development Framework of the present invention can easily realize that the multipage similar to conventional browser is answered With program, solves the problems, such as the biography ginseng of multi-page and each interprocess communication, developer is only focused in specific Service details, the specific implementation without paying close attention to message communicating.
(4) use MVC development mode: Development Framework of the present invention encapsulates MVC development mode, and Each performs its own functions for modules Development task is completed, the exploitation experience for being similar to tradition Web application is provided, the naming convention of various components also all follows mainstream frame Frame development philosophy, developer is convenient for grasping, to improve application development efficiency.
(5) encapsulate common function: Development Framework of the present invention encapsulate such as global state, data save, http request with The general services such as response, message informing, file service, example menu configuration, it is each that developer also can according to need voluntarily extension A service.
(6) host process and rendering process lifetime trustship: Development Framework of the present invention is realized using assisted process mode The life cycle trustship of host process and rendering process, developer can easily register in required life cycle corresponding Call back function.
Detailed description of the invention
Fig. 1 is a kind of cross-platform multipad Development Framework based on electron provided in an embodiment of the present invention System structure diagram;
Fig. 2 is the sequence chart of Http provided in an embodiment of the present invention request and answer service;
Fig. 3 is the sequence chart of messaging service provided in an embodiment of the present invention;
Fig. 4 is the sequence chart of state machine service provided in an embodiment of the present invention;
Fig. 5 is the sequence chart provided in an embodiment of the present invention that service is locally stored;
Fig. 6 is a kind of frame of the cross-platform multipad Development Framework based on electron provided in an embodiment of the present invention Use Case Map;
Fig. 7 is a kind of use of the cross-platform multipad Development Framework based on electron provided in an embodiment of the present invention The flow diagram of method;
Fig. 8 is a kind of operation of the cross-platform multipad Development Framework based on electron provided in an embodiment of the present invention The flow diagram of method;
Fig. 9 is the flow diagram in application program launching stage provided in an embodiment of the present invention;
Figure 10 is the flow diagram of MVC example operation phase provided in an embodiment of the present invention;
Figure 11 is routing provided in an embodiment of the present invention and the flow diagram in biography ginseng stage;
Figure 12 is a kind of mesh of the cross-platform multipad Development Framework based on electron provided in an embodiment of the present invention Directory structures schematic diagram.
Specific embodiment
To make the object, technical solutions and advantages of the present invention clearer, below in conjunction with attached in the embodiment of the present invention Figure, technical solution in the embodiment of the present invention are explicitly described, it is clear that described embodiment is a part of the invention Embodiment, instead of all the embodiments.Based on the embodiments of the present invention, those of ordinary skill in the art are not making wound Every other embodiment obtained under the premise of the property made labour, shall fall within the protection scope of the present invention.
As shown in Figure 1, Development Framework provided in an embodiment of the present invention be logically divided into common component module, scheduler module, Four modules of framework services module and MVC example module.
(1) scheduler module
Scheduler module needs work together with electron.Scheduler module is divided into host process module and rendering scheduler module, described Host process module and rendering scheduler module extends and have assisted process module, respectively host process assisted process module with render into Journey assisted process module.
Host process assisted process module, for safeguarding IPC channel when electron starts main.js;Specifically: When electron host process starts main.js, it is injected into electron host process, so that being safeguarded originally by electron IPC channel hand to Development Framework host process assisted process module maintenance.By binding onReady event, start from upper The script of host process assisted process inside modules is explained downwards.
And it renders process assisted process module and is then responsible for creation MVC example, and to host process module in trustship MVC example Communication.
(2) common component module
Common component module can individually integrate and be implemented separately function, common component inside modules collection independently of electron At having routing submodule, configuration submodule and log submodule, for realizing public routing, configuration and journal function.
Submodule is routed, for saving routing parameter, opening new view and obtaining routing parameter;
Submodule is configured, for being based on global configuration item appconfig.json file acquisition key-value pair configuration item;Global configuration Item appconfig.json file: refer to the global configuration file of application program, be a json file;
Log submodule is divided into the log of multiple ranks, calls on demand for developer.
(3) framework services module
File system service, Http request and response clothes including enhancing are devised in this Development Framework for common business scenario Business, messaging service, state machine service, 5 big services being locally stored including service, encapsulate common methods, shape At corresponding file system service submodule, Http request and answer service submodule, messaging service submodule, state machine Attendant sub-module and Attendant sub-module is locally stored and retains corresponding module interface, is called on demand for developer.
3.1) file system service submodule provides file system service
The file system service of enhancing has invoked fs module and child_process module built in Node.js, for handling text Part and execution command line instructions.Design provides reading and writing of files, the synchronization of file, asynchronous method, creates file, file side Method judges that file or folder whether there is, and deletes multiple methods such as file and file, and should be illegal behaviour The log (being defaulted as warn) of the customized rank of the developer that notes down.
3.2) Http request provides Http request and answer service with answer service submodule
Http request uses lightweight network communication library unirest with answer service, and Http request is defaulted as post request, and The Content-Type and Accept for configuring header are application/json.Fig. 2 is Http request and answer service Sequence chart." program frame " in figure refers to Development Framework of the present invention.Lightweight network communication library unirest: refer to unirest Library, it is the third party library of a nodejs, open source, for handling lightweight network communication.
3.3) messaging service submodule provides messaging service
Electron-notification component can be used to be designed for messaging service, and retains to call to developer and connect Mouthful.It includes two methods that it is internal, is general notification service, mistake or abnormal notice service respectively.Based on electron- Notification official document, pop-up event can specify the parameters such as message notifying, button array, time-out time, and message is logical Know and button is reserved to developer, time-out time can configure notifyTimeOut field in configuration file.Fig. 3 is message Notify the sequence chart of service.
3.4) state machine service submodule provides state machine service
Status management service in application life cycles is responsible for opening up global buffer, is used to by host process assisted process module Global state machine variable is saved, Map object implementatio8 is used.For status service, a point situation discussion is needed.If host process mould Block calls global state machine, then is called by global mode;If assisted process module calls global state machine, by long-range Object approach calls.The access of state is mainly realized by above two mode.
In this way, state machine service submodule can be simultaneously in host process module and auxiliary after application initialization It is called in scheduler module, to realize the function of maintenance global state.Fig. 4 is the sequence chart of state machine service.
3.5) Attendant sub-module offer is provided, service is locally stored
The service of being locally stored mainly saves key-value pair data by localStorage object.This module design uses Window.localStorage object carries out local simple data persistence, and developer can voluntarily be held using other data Longization scheme rewrites this service.Fig. 5 is the sequence chart for the service that is locally stored.
(4) MVC example module
Framework encapsulation MVC development mode (Model, View, Controller), Each performs its own functions completes exploitation and appoint for modules Business provides the exploitation experience for being similar to tradition Web application, so that developer is unlikely to be strange, the name of various components is about Fixed also all to follow mainstream Development of Framework principle, developer is easy to grasp.
Model is responsible for the related processing of data model, and view is to show to the view of user, and html grammer volume can be used It writes, controller is responsible for dispatching and realizing specific logic.Matching under common module can be called in controller Reading, routing and log module are set, each service under service can also be called.
Substantially, the Development Framework in the embodiment of the present invention is the extension and supplement to existing electron, therefore is developed Frame holds the partial objects in host process using the mode of assisted process, and injects MVC by the example of window object, thus Complete the function of needing.
As shown in fig. 6, mainly including two kinds of roles: electron itself in the application program constructed using Development Framework With Development Framework (electron-quick-start-framework i.e. in figure, also abbreviation framework).Electron sheet Body has held host process, rendering process, App object and IPC channel.Development Framework is then responsible for holding host process and renders process Assisted process, window example simultaneously inject MVC example.Meanwhile two assisted process extend IPC channel, so that host process, rendering The communication that can be convenient between process, host process assisted process and rendering this four processes of process assisted process.
As shown in fig. 7, the embodiment of the present invention provides a kind of cross-platform multipad exploitation frame based on electron The application method of frame, comprising the following steps:
S701: the exploitation environment and rely on management tool that installation Development Framework relies on, and dispose corresponding Development Framework code;
S702: the packet management tool of the build tool is installed, and is relied on needed for the dependence library downloading according to Development Framework configuration;Specifically Ground, packet management tool refer to npm program;
S703: modification Development Framework configuration item is to be applicable in business scenario;
Specifically, Development Framework head view configuration item is revised as application program entry view in Development Framework configuration file Name, and add required custom parameter.
S704: the service logic according to Development Framework rule for the business scenario writes code;
Specifically, this step includes following sub-step:
S7041: view code is write using html grammer in view file and introduces controller corresponding with view name File;
S7042: writing code logic in controller file, using Node.js grammer and mixes other front end frames, it is described its His front end frame includes jQuery;
S7043: draw call common component module, scheduler module, the content in framework services module on demand;
S7044: calling its opening view approach in controller file after introducing base class controller, described to open new view side Method is used to indicate routing submodule and loads new view;Specifically, this step includes following sub-step:
A) the base class controller of frame is introduced or inherited in controller code;
B) the new view approach of opening of base class controller is called in controller code, the new view approach of opening passes through IPC Mechanism sends route signal amount to host process assisted process;The new view approach of opening passes through interprocess signal amount communication mechanism Route signal amount is sent to host process assisted process;
C) host process assisted process receives and routing parameter is stored in global buffer after semaphore;
D) host process assisted process calls the resource loading method of global browser window object instance to load new view;
E) the base class controller of frame is introduced or inherited in the corresponding controller code of new view;
F) call the acquisition window parameter method of base class controller to obtain transmitting in the corresponding controller code of new view Routing parameter.
Base class controller: in Object-Oriented Programming mode, it is possible that inheritance, i.e. partial objects are between object Parent, partial objects are the subclasses of parent, and there are inheritance, base class controllers, that is, each controller pair between subclass and parent The parent of elephant, each controller are the subclasses of base class controller, and each controller inherits base class controller, base class controller pair Answer the BaseController.js file in item code.
Open new view approach: i.e. developer encounters needs and opens new view when writing specific service logic using frame The method called when figure.For example, QQ user is currently chatting with A, B sends message at this time, and user clicks the head portrait of B, The chat window that B can then be opened, the method that the opening of B chat window is controlled in code are referred to as new window method of making.Depending on Figure is alternatively referred to as window.
Global browser window object instance: the creation of each window will have a specific object to be operated, This object is exactly global browser window object instance, wherein this attribute of " can be called in entire frame " Referred to as global, browser window object is a specific object, is the content in frame, and example i.e. expression one is specific Individual.It is responsible for generating " window object example ", and BrowserWindow object is refered in particular in Development Framework of the present invention.
Resource loading method: view is substantially a kind of resource to window in other words, and resource loading method is to pass through basis The specified view file of the variable load of given the method, and the method parsed.
S7045: it calls the acquisition window of base class controller to pass ginseng function and receives routing parameter in new view.
S705: debugging is completed using the build tool and is packaged.
Specifically, it completes to be packaged using the build tool specifically: packaging operation is carried out using the instruction of packet management tool, and Generate the installation procedure of corresponding platform.
As shown in figure 8, the embodiment of the present invention provides a kind of cross-platform multipad exploitation frame based on electron The operation method of frame, comprising the following steps:
S801: the application program launching stage: start main.js using electron, utilize host process assisted process module creation Window object example, and view file is loaded, controller is introduced by the src attribute of script label;
Specifically, as shown in figure 9, in the application program launching stage, electron is identified by reading in package.json Application program entry main.js starts entire application program, in main.js by interpretation process from the top down, at the beginning of code Beginningization app object, and " preparation " event is registered, " exiting " event is registered later.Due to the non-block type IO of Node.js and event The characteristic of driving, electron can successively call life cycle function after registration " preparation " event.In Fig. 9, Onready event " preparation " event of expression;Quit event indicates " exiting " event.
It is a series of that so-called life cycle function refers to that program can be executed particular point in time (when corresponding event occurs) The group of functions executed in order.For example the onReady of this frame is exactly the function that can be executed when frame prepares, quit is to work as frame Frame prepares the function executed when exiting.Execution sequence must after first carrying out onReady function be likely to that quit letter can be executed Number.
After registering " preparation " event in main.js context, firstly, calling the window in host process assisted process module Mouth creation method (i.e. MainProcessHelper.createWindow) reads appconfig.json file, creates one Window object example (i.e. BrowserWindow object instance);Next, it is determined whether being debugging mode: if so, opening exploitation Person's debugging tool (i.e. openDevTools) loads view file followed by resource loading method;If it is not, then directly passing through Resource loading method loads first view file;It is read finally, being rendered during kernel parses from top to bottom in view file Controller (i.e. controller.js) is introduced to script label, and by src attribute, completes the start-up course entirely applied.
The S802:MVC example operation phase: after application program launching, rendering kernel passes through the src attribute of script label Controller is found, controller code is loaded onto memory, on-demand invocation framenort service module and/or common component module;
Specifically, as shown in Figure 10, after application program launching, rendering kernel loads document flow from top to bottom, until being loaded into Script label and there are src attributes, finds controller by the src attribute of script label;Then, by controller code plus It is loaded onto memory, controller code is explained from the top down, this step, that is, registrable or binding event, reference model or other clothes Business and common component: for example, if introducing model, model code is explained from up to down;If introducing model, MVC example fortune Row process terminates.
S803: routing jump method when controller code triggers in the process of running, then executes routing and pass ginseng process Open new view.
Specifically, the execution routing and biography ginseng process specifically:
As shown in figure 11, during former view, rendering process assisted process module is adjusted by remote object (remote object) With global buffer, " new page parameter will be transmitted to " and be stored in the global buffer;Utilize rendering process assisted process module IPC object send route signal to the IPC object of host process assisted process module, the IPC object of host process assisted process is received The resource loading method (i.e. Browser object reference loadFile) of window object example is called after to signal, the resource adds Support method is used to load view corresponding with the view name that host process module is sent, and former view process finishes;Wherein, described Global buffer is stated in advance by host process assisted process module.During new view, host process assisted process module wound BrowserWindow object subprocess is built, the new view controller of process assisted process module loading, new view controller tune are rendered With window parameter method is obtained, the acquisition window parameter method is used to be stored in the global buffering by remote object acquisition " being transmitted to new page parameter " in area.So far, routing and pass ginseng process terminates, from the user's point of view just as browser has occurred once It jumps.
It should be noted that from the data flow of Development Framework analyze, the input of Development Framework be generally configuration file and The customized other types file of developer, network flow etc., according to specifically using different and same.The output of Development Framework is general For journal file, console standard output and the customized file of other developers, data flow etc., not according to specific application One and it is same.
Finally, it should be noted that the above embodiments are merely illustrative of the technical solutions of the present invention, rather than its limitations;Although Present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that: it still may be used To modify the technical solutions described in the foregoing embodiments or equivalent replacement of some of the technical features; And these are modified or replaceed, technical solution of various embodiments of the present invention that it does not separate the essence of the corresponding technical solution spirit and Range.

Claims (10)

1. a kind of cross-platform multipad Development Framework based on electron characterized by comprising common component mould Block, scheduler module, framework services module and MVC example module;The common component inside modules are integrated with routing submodule, match Set submodule and log submodule;The scheduler module includes host process module and rendering scheduler module, the host process module Extending with rendering scheduler module has assisted process module, respectively host process assisted process module and rendering process assisted process Module;The framework services module includes file system service submodule, Http request and answer service submodule, message informing Attendant sub-module, state machine service submodule and Attendant sub-module is locally stored;
The routing submodule, for saving routing parameter, opening new view and obtaining routing parameter;
The configuration submodule, for being based on global configuration item appconfig.json file acquisition key-value pair configuration item;
The log submodule, is divided into the log of multiple ranks, calls on demand for developer;
The host process assisted process module, for safeguarding IPC channel when electron starts main.js;
The rendering process assisted process module is for creating MVC example, and leading to host process module in trustship MVC example Letter;
The file system service submodule, for by calling fs module and child_process module built in Node.js To handle file and execute command line instructions;
Http request is defaulted as by the Http request and answer service submodule using lightweight network communication library unirest Post request, and the Content-Type and Accept that configure header are application/json;
The messaging service submodule, for prompting the service of common message notice and mistake/unexpected message notice service;
The state machine service submodule, for storing global state machine variable, after application initialization, host process mould Block and/or assisted process module safeguard global state by calling the state machine service submodule;
It is described that Attendant sub-module is locally stored, for saving key-value pair data by localStorage object;
The MVC example module, for storing the MVC example of rendering process assisted process module creation.
2. Development Framework according to claim 1, which is characterized in that the host process assisted process module is also used to: logical Binding preparation event is crossed, explains the script of the host process assisted process module from the top down.
3. Development Framework according to claim 1, which is characterized in that the host process module and/or assisted process module Global state is safeguarded by calling the state machine service submodule specifically:
If host process module calls global state machine, called by global mode;
If assisted process module calls global state machine, called by remote object mode.
4. a kind of application method of the cross-platform multipad Development Framework based on electron characterized by comprising
Step 1: the exploitation environment and rely on management tool that installation Development Framework relies on, and dispose corresponding Development Framework code;
Step 2: the packet management tool of the build tool being installed, and is relied on needed for the dependence library downloading according to Development Framework configuration;
Step 3: modification Development Framework configuration item is to be applicable in business scenario;
Step 4: the service logic according to Development Framework rule for the business scenario writes code;
Step 5: completing debugging using the build tool and be packaged.
5. application method according to claim 4, which is characterized in that the step 3 specifically:
Development Framework head view configuration item is revised as application program entry view name in Development Framework configuration file, and is added Required custom parameter.
6. application method according to claim 4, which is characterized in that the step 4 specifically:
Step 4.1: writing view code using html grammer in view file and introduce control corresponding with view name Device file;
Step 4.2: code logic is write in controller file, using Node.js grammer and mixes other front end frames, it is described Other front end frames include jQuery;
Step 4.3: drawing call common component module interface, scheduler module interface and framework services module interface on demand;
Step 4.4: the new view approach of opening of calling base class controller after base class controller is introduced in controller file, it is described It opens new view approach and is used to indicate the new view of routing submodule load;
Step 4.5: the acquisition window parameter method of base class controller being called to receive routing parameter in new view.
7. application method according to claim 6, which is characterized in that the step 4.4 specifically includes:
Step 4.4.1: the base class controller of Development Framework is introduced or inherited in controller code;
Step 4.4.2: calling the new view approach of the opening of base class controller in controller code, described to open new view Method sends route signal amount to host process assisted process by IPC mechanism;
Step 4.4.3: host process assisted process module receives and routing parameter is stored in global buffer after semaphore;
Step 4.4.4: host process assisted process module calls the resource loading method load of global browser window object instance New view;
Step 4.4.5: the base class controller of Development Framework is introduced or inherited in the corresponding controller code of new view;
Step 4.4.6: call the acquisition window parameter method of base class controller to obtain in the corresponding controller code of new view Take the routing parameter of transmitting.
8. application method according to claim 4, which is characterized in that being beaten using the build tool completion in the step 5 Packet specifically:
Packaging operation is carried out using the instruction of the packet management tool, and generates the installation procedure of corresponding platform.
9. a kind of operation method of the cross-platform multipad Development Framework based on electron characterized by comprising
Step 1: the application program launching stage: starting main.js using electron, utilize host process assisted process module creation Window object example, and view file is loaded, controller is introduced by the src attribute of script label;
The step 2:MVC example operation phase: after application program launching, rendering kernel is looked for by the src attribute of script label To controller, controller code is loaded onto memory, on-demand invocation framenort service module and/or common component module;
Step 3: routing jump method when controller code triggers in the process of running, then execute routing and pass ginseng process to open New view.
10. according to the method described in claim 9, it is characterized in that, execution routing and biography ginseng process specifically:
During former view, rendering process assisted process module will be routed by the public global buffer of remote object invocation Parameter is stored in the public global buffer;Using rendering process assisted process module IPC object send route signal to The IPC object of host process assisted process module, the IPC object of host process assisted process call window object example after receiving signal Resource loading method, the resource loading method is used to load and the corresponding view of view name of host process module transmission Figure, former view process finish;Wherein, the public global buffer is stated in advance by host process assisted process module;
During new view, controller calls the window parameter method that obtains, and the acquisition window parameter method is used for by remote Journey object acquisition is stored in the routing parameter in the public global buffer.
CN201910520250.0A 2019-06-17 2019-06-17 A kind of cross-platform multipad Development Framework and method based on electron Pending CN110275700A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910520250.0A CN110275700A (en) 2019-06-17 2019-06-17 A kind of cross-platform multipad Development Framework and method based on electron

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910520250.0A CN110275700A (en) 2019-06-17 2019-06-17 A kind of cross-platform multipad Development Framework and method based on electron

Publications (1)

Publication Number Publication Date
CN110275700A true CN110275700A (en) 2019-09-24

Family

ID=67960897

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910520250.0A Pending CN110275700A (en) 2019-06-17 2019-06-17 A kind of cross-platform multipad Development Framework and method based on electron

Country Status (1)

Country Link
CN (1) CN110275700A (en)

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111190581A (en) * 2019-12-26 2020-05-22 中国地质大学(武汉) Visual flowsheet machine learning and artificial intelligence platform
CN111221669A (en) * 2020-01-16 2020-06-02 广东三维家信息科技有限公司 Parameter transmission method and device and electronic equipment
CN111813438A (en) * 2020-07-16 2020-10-23 成都安恒信息技术有限公司 Cross-platform application packaging method based on JavaScript
CN112463198A (en) * 2020-12-09 2021-03-09 深圳智药科技有限公司 Updating method and system based on Electron
CN112799652A (en) * 2021-02-08 2021-05-14 北京乐学帮网络技术有限公司 Client construction method and device, electronic equipment and storage medium
CN112799665A (en) * 2021-01-27 2021-05-14 视若飞信息科技(上海)有限公司 Method for constructing App functional interface in WebUI mode
CN113268239A (en) * 2021-06-04 2021-08-17 平安科技(深圳)有限公司 Desktop application view construction method, device, equipment and storage medium
CN115237386A (en) * 2022-09-19 2022-10-25 杭州实在智能科技有限公司 Method and system for developing large-scale complex Windows native desktop
CN115269442A (en) * 2022-09-26 2022-11-01 南京飓风引擎信息技术有限公司 Debugging method and tool based on graphic interface architecture and management project
CN115658023A (en) * 2022-11-14 2023-01-31 广东美的暖通设备有限公司 Building cockpit system generation method, device, equipment, medium and product

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
小狄子: "Electron快速开发框架", 《HTTPS://GITEE.COM/DYC289686387/ELECTRON-QUICK-START-FRAMEWORK》 *

Cited By (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111190581B (en) * 2019-12-26 2021-05-28 中国地质大学(武汉) Visual flowsheet machine learning and artificial intelligence system
CN111190581A (en) * 2019-12-26 2020-05-22 中国地质大学(武汉) Visual flowsheet machine learning and artificial intelligence platform
CN111221669B (en) * 2020-01-16 2023-07-07 广东三维家信息科技有限公司 Parameter transmission method and device and electronic equipment
CN111221669A (en) * 2020-01-16 2020-06-02 广东三维家信息科技有限公司 Parameter transmission method and device and electronic equipment
CN111813438A (en) * 2020-07-16 2020-10-23 成都安恒信息技术有限公司 Cross-platform application packaging method based on JavaScript
CN111813438B (en) * 2020-07-16 2023-08-22 成都安恒信息技术有限公司 Cross-platform application packaging method based on JavaScript
CN112463198A (en) * 2020-12-09 2021-03-09 深圳智药科技有限公司 Updating method and system based on Electron
CN112463198B (en) * 2020-12-09 2021-06-22 深圳智药科技有限公司 Updating method and system based on Electron
CN112799665A (en) * 2021-01-27 2021-05-14 视若飞信息科技(上海)有限公司 Method for constructing App functional interface in WebUI mode
CN112799652A (en) * 2021-02-08 2021-05-14 北京乐学帮网络技术有限公司 Client construction method and device, electronic equipment and storage medium
CN113268239A (en) * 2021-06-04 2021-08-17 平安科技(深圳)有限公司 Desktop application view construction method, device, equipment and storage medium
CN113268239B (en) * 2021-06-04 2023-08-11 平安科技(深圳)有限公司 View construction method, device, equipment and storage medium of desktop application
CN115237386B (en) * 2022-09-19 2022-12-27 杭州实在智能科技有限公司 Method and system for developing large-scale complex Windows native desktop
CN115237386A (en) * 2022-09-19 2022-10-25 杭州实在智能科技有限公司 Method and system for developing large-scale complex Windows native desktop
CN115269442B (en) * 2022-09-26 2023-01-10 南京飓风引擎信息技术有限公司 Debugging method and tool based on graphic interface architecture and management project
CN115269442A (en) * 2022-09-26 2022-11-01 南京飓风引擎信息技术有限公司 Debugging method and tool based on graphic interface architecture and management project
CN115658023A (en) * 2022-11-14 2023-01-31 广东美的暖通设备有限公司 Building cockpit system generation method, device, equipment, medium and product

Similar Documents

Publication Publication Date Title
CN110275700A (en) A kind of cross-platform multipad Development Framework and method based on electron
US20020026447A1 (en) System for designing and performing web application
EP2284698B1 (en) Compositional modeling of integrated systems using event-based legacy applications
Gülcü The complete log4j manual
CN111343181A (en) Message processing method and system, data pool and computer readable storage medium
CN115309398A (en) Multi-application micro front end implementation method based on software development framework derivation
CN117519877A (en) Rendering method and device of quick application card, storage medium and electronic equipment
CN111596905A (en) Method, device, storage medium and terminal for generating java object
US10268496B2 (en) System and method for supporting object notation variables in a process defined by a process execution language for execution in a SOA middleware environment
US10223143B2 (en) System and method for supporting javascript as an expression language in a process defined by a process execution language for execution in a SOA middleware environment
WO2023124657A1 (en) Micro-application running method and apparatus, device, storage medium, and program product
Paronen A web-based monitoring system for the Industrial Internet
Gui et al. A Hybrid real-time component model for reconfigurable embedded systems
CN115509531A (en) Micro front end implementation method, device, terminal and storage medium based on front end technology
Grabe et al. Credo methodology: modeling and analyzing a peer-to-peer system in credo
Cechticky et al. A UML2 profile for reusable and verifiable software components for real-time applications
CN113835904A (en) Remote procedure call control method, device, equipment and storage medium
Haller et al. RAY: Integrating Rx and Async for direct-style reactive streams
WO2007041901A1 (en) System and method for formal verification of statecharts
Mráz Component-based UI Web Development
Qiu et al. Research on Real-Time Software Development Approach.
CN114721655A (en) Method for remotely deploying MATLAB function
Drießen Modularity by design for safety-critical software systems
Canfora et al. A flexible wrapper for the migration of interactive legacy system to Web services
Wadia et al. The Definitive Guide to Apache MyFaces and Facelets

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20190924