WO2019052417A1 - Page loading method and apparatus, electronic device and storage medium - Google Patents

Page loading method and apparatus, electronic device and storage medium Download PDF

Info

Publication number
WO2019052417A1
WO2019052417A1 PCT/CN2018/104784 CN2018104784W WO2019052417A1 WO 2019052417 A1 WO2019052417 A1 WO 2019052417A1 CN 2018104784 W CN2018104784 W CN 2018104784W WO 2019052417 A1 WO2019052417 A1 WO 2019052417A1
Authority
WO
WIPO (PCT)
Prior art keywords
sub
module
page
anniejs
function module
Prior art date
Application number
PCT/CN2018/104784
Other languages
French (fr)
Chinese (zh)
Inventor
徐闻东
Original Assignee
广州优视网络科技有限公司
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 广州优视网络科技有限公司 filed Critical 广州优视网络科技有限公司
Publication of WO2019052417A1 publication Critical patent/WO2019052417A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading

Definitions

  • the present invention relates to the field of Internet technologies, and in particular, to a page loading method, apparatus, electronic device, and storage medium.
  • AnnieJs is a 2d animation engine that focuses on Html5 interactive interaction.
  • Webpack is a module loader and a packaging tool. Webpack introduces and packages AnnieJs into the final resource file for page loading. However, currently only the script tag is supported to introduce AnnieJs, the page will have one more resource request, and the page load takes a long time.
  • an object of embodiments of the present invention is to provide a page loading method, apparatus, electronic device, and storage medium to improve the above problems.
  • the technical solution adopted by the present invention is as follows:
  • an embodiment of the present invention provides a page loading method, which is applied to a resource obtained by a packaging tool, where the resource includes a customized resource file, and a preset main module of AnnieJs is introduced in the resource file.
  • the main module of the AnnieJs includes a plurality of sub-function modules, the main module of the AnnieJs is provided with a main interface, and each sub-function module is correspondingly provided with a respective calling interface, and each of the sub-function modules is respectively used to implement a function, the method
  • the method includes: calling the resource file in a page to be displayed; calling a target sub-function module required by the page to be displayed in the sub-function module by calling a main interface of an AnnieJs main module introduced in the resource file; Loading a function corresponding to the target sub-function module in the page to be displayed.
  • an embodiment of the present invention provides a page loading apparatus, which is applied to a resource obtained by a packaging tool, where the resource includes a customized resource file, and a preset main module of AnnieJs is introduced into the resource file.
  • the main module of the AnnieJs includes a plurality of sub-function modules, the main module of the AnnieJs is provided with a main interface, and each sub-function module is correspondingly provided with a respective calling interface, and each of the sub-function modules is respectively used to implement a function, the device
  • the first calling unit, the second calling unit, and the loading unit are included.
  • a first calling unit configured to invoke the resource file in a page to be displayed.
  • a second calling unit configured to invoke a target sub-function module required by the page to be displayed in the sub-function module by calling a main interface of the AnnieJs main module introduced in the resource file.
  • a loading unit configured to load a function corresponding to the target sub-function module in the page to be displayed.
  • an embodiment of the present invention provides an electronic device, where the electronic device includes a processor and a memory, the processor and the memory are electrically connected by a bus; the memory is used to store a program; the processor For calling the program stored in the memory by the bus, executing: calling a resource file in a page to be displayed; calling the sub-function module by calling a main interface of the AnnieJs main module introduced in the resource file Displaying a target sub-function module required by the page; loading a function corresponding to the target sub-function module in the to-be-displayed page.
  • an embodiment of the present invention provides a storage medium storing program code executable by a processor, the program code being configured to cause the processor to execute the method.
  • the method for loading a page, the electronic device, and the storage medium are applied to the resource obtained by the packaging tool, where the resource includes a customized resource file, and the preset AnnieJs is introduced into the resource file.
  • the main module, the AnnieJs main module includes a plurality of sub-function modules, the AnnieJs main module is provided with a main interface, and each sub-function module is correspondingly provided with a respective calling interface, and each of the sub-function modules is respectively used to implement a function.
  • the method includes: calling the resource file in a page to be displayed; calling a target interface of the to-be-displayed page in the sub-function module by calling a main interface of an AnnieJs main module introduced in the resource file a function module; loading a function corresponding to the target sub-function module in the to-be-displayed page, thereby introducing a resource request generated by the AnnieJs through the script tag by introducing an AnnieJs main module into a resource file called by the page to be displayed, Thereby reducing resource requests and optimizing page loading performance.
  • FIG. 1 is a structural block diagram of an electronic device applicable to an embodiment of the present invention
  • FIG. 2 is a flowchart of a page loading method according to an embodiment of the present invention.
  • FIG. 3 is a schematic diagram of multiple functional modules in an AnnieJs main module according to an embodiment of the present invention.
  • FIG. 4 is a schematic diagram of an main module of AnnieJs according to an embodiment of the present invention.
  • FIG. 5 is a schematic diagram of a base class AObject module of an Annie engine class according to an embodiment of the present invention
  • FIG. 6 is a structural block diagram of a page loading apparatus according to an embodiment of the present invention.
  • FIG. 1 is a block diagram showing the structure of an electronic device 100 that can be applied to an embodiment of the present invention.
  • the electronic device 100 can include a memory 102, a memory controller 104, one or more (only one shown in FIG. 1) processor 106, a peripheral interface 108, an input and output module 110, an audio module 112, The display module 114, the radio frequency module 116, and the page loading device.
  • the memory 102, the memory controller 104, the processor 106, the peripheral interface 108, the input and output module 110, the audio module 112, the display module 114, and the RF module 116 are electrically connected directly or indirectly to each other to implement data transmission or Interaction.
  • these components can be electrically connected by one or more communication buses or signal buses.
  • the page loading methods respectively include at least one software function module that can be stored in the memory 102 in the form of software or firmware, such as a software function module or a computer program included in the page loading device.
  • the memory 102 can store various software programs and modules, such as the page loading method and the program instructions/modules corresponding to the device provided by the embodiments of the present application.
  • the processor 106 executes various function applications and data processing by running software programs and modules stored in the memory 102, that is, implementing the page loading method in the embodiment of the present application.
  • the memory 102 can include, but is not limited to, Random Access Memory (RAM), Read Only Memory (ROM), Programmable Read-Only Memory (PROM), erasable read-only Erasable Programmable Read-Only Memory (EPROM), Electric Erasable Programmable Read-Only Memory (EEPROM), and the like.
  • RAM Random Access Memory
  • ROM Read Only Memory
  • PROM Programmable Read-Only Memory
  • EPROM erasable read-only Erasable Programmable Read-Only Memory
  • EEPROM Electric Erasable Programmable Read-Only Memory
  • Processor 106 can be an integrated circuit chip with signal processing capabilities.
  • the processor may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP processor, etc.), or a digital signal processor (DSP) or an application specific integrated circuit (ASIC). ), off-the-shelf programmable gate arrays (FPGAs) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
  • the methods, steps, and logical block diagrams disclosed in the embodiments of the present application can be implemented or executed.
  • the general purpose processor may be a microprocessor or the processor or any conventional processor or the like.
  • peripheral interface 108 couples various input/input devices to the processor 106 and the memory 102.
  • peripheral interface 108, processor 106, and memory controller 104 can be implemented in a single chip. In other instances, they can be implemented by separate chips.
  • the input and output module 110 is configured to provide input data to the user to implement user interaction with the electronic device 100.
  • the input and output module 110 can be, but is not limited to, a mouse, a keyboard, and the like.
  • the audio module 112 provides an audio interface to the user, which may include one or more microphones, one or more speakers, and audio circuitry.
  • the display module 114 provides an interactive interface (eg, a user interface) between the electronic device 100 and the user or for displaying image data to the user for reference.
  • the display module 114 can be a liquid crystal display or a touch display.
  • a touch display it can be a capacitive touch screen or a resistive touch screen that supports single-point and multi-touch operations. Supporting single-point and multi-touch operations means that the touch display can sense simultaneous touch operations from one or more locations on the touch display, and the touch operation is transferred to the processor 106. Perform calculations and processing.
  • the radio frequency module 116 is configured to receive and transmit electromagnetic waves, and realize mutual conversion between electromagnetic waves and electric signals, thereby communicating with a communication network or other devices.
  • FIG. 1 is merely illustrative, and the electronic device 100 may further include more or less components than those shown in FIG. 1, or have a different configuration from that shown in FIG. 1.
  • the components shown in Figure 1 can be implemented in hardware, software, or a combination thereof.
  • the electronic device 100 can function as a user terminal or as a server.
  • the user terminal can be a terminal device such as a PC (personal computer) computer, a tablet computer, a mobile phone, a notebook computer, a smart TV, a set top box, or a vehicle terminal.
  • a client can be installed in the electronic device 100, and the client can be a browser or a third-party application.
  • an embodiment of the present invention provides a page loading method, which is applied to a resource obtained by a packaging tool, where the resource includes a customized resource file, and a preset main module of AnnieJs is introduced in the resource file.
  • the main module of the AnnieJs includes a plurality of sub-function modules, and the main module of the AnnieJs is provided with a main interface, and each sub-function module is correspondingly provided with a respective calling interface, and each of the sub-function modules is respectively configured to implement a function,
  • the method includes: step S200, step S210, and step S220.
  • Step S200 The resource file is called in a page to be displayed.
  • the resource file may be a Javascript file.
  • the packaging tool can be a webpack. Webpack is a module loader and a packaging tool.
  • Step S210 Call the target sub-function module required by the page to be displayed in the sub-function module by calling the main interface of the AnnieJs main module introduced in the resource file.
  • the target sub-function required for the page to be displayed in the sub-function module is called. Module.
  • AnnieJs is a 2d animation engine that focuses on Html5 interactive interaction.
  • each class in AnnieJs is a functional module, such as the base class AObject of the annie engine class, the event trigger class EventDispatcher, the event class Event, the mouse event class MouseEvent, and the 2-dimensional matrix Matrix.
  • the collection of multiple function modules is encapsulated into the main module of AnnieJs, corresponding to the main interface.
  • the main interface corresponding to the main module of AnnieJs is externally called, and the main module of AnnieJs includes multiple sub-function modules, and then the sub-functions are called.
  • the calling interface corresponding to the module calls the sub-function module corresponding to the calling interface. For example, in webpack, you can introduce the native AnnieJs main module via require.
  • AnnieJs can include multiple classes. Each class corresponds to a functional module. Function modules can be used to implement animation functions.
  • AObject is the base class for the Annie engine class. EventDispatcher triggers the base class for the event. Event is the event class, the base class for all events in the Annie engine.
  • MouseEvent is a mouse event class. Point is a point class. Matrix is a 2-dimensional matrix. Rectangle is a rectangular class.
  • DisplayObject is the display object lottery class.
  • Bitmap is a bitmap file class. Shape is a vector object class. Sprite is the container class for display objects. ImageFrames draws the contents of the img sequence into the canvas. MovieClip is the core class of the Annie engine.
  • VideoPlayer is used to form the effect of continuous playback of video content or sequence pictures into the canvas to facilitate interaction.
  • TextField is a dynamic text class. Stage is the entire area that represents the contents of the canvas.
  • ShadowFilter is a projection or illuminating filter.
  • ColorFilter is a common color filter.
  • ColorMatrixFilter is a matrix color filter.
  • BlurFilter is a blur filter.
  • CanvasRender is a Canvas renderer.
  • WGRender is a WebGl renderer.
  • URLLoader loads classes for resources. RESManager loads the management module for the resource. Tween is a global static single-column class.
  • MovieClip is a class in the core class of the Annie engine.
  • Step S220 Load the function corresponding to the target sub-function module in the page to be displayed.
  • step S210 further acquiring an ID code corresponding to the target sub-function module, calling the target sub-function module corresponding to the corresponding ID code, and loading in the to-be-displayed page The function corresponding to the target sub-function module.
  • each Aninie engine object will have a unique id code, and the base class AObject has a unique one.
  • the id code get the id code, call the AObject module to implement the corresponding function.
  • a page loading method provided by the embodiment of the present invention is applied to a resource obtained by a packaging tool, where the resource includes a customized resource file, and a preset main module of AnnieJs is introduced in the resource file, and the main module of the AnnieJs is introduced.
  • a plurality of sub-function modules are provided, and the main module of the AnnieJs is provided with a main interface, and each sub-function module is correspondingly provided with a respective calling interface, and each of the sub-function modules is used to implement a function, and the method includes: waiting for Calling the resource file in the display page; calling the target sub-function module required for the page to be displayed in the sub-function module by calling the main interface of the main module of the AnnieJs introduced in the resource file; Loading the function corresponding to the target sub-function module in the page, thereby introducing the resource file called by the AnnieJs main module to the page to be displayed, and avoiding introducing the resource request generated by the AnnieJs through the script tag, thereby reducing the resource request and optimizing the page loading. performance.
  • an embodiment of the present invention provides a page loading apparatus 300, which is applied to a resource obtained by a packaging tool, where the resource includes a customized resource file, and a preset main module of AnnieJs is introduced into the resource file.
  • the AnnieJs main module includes a plurality of sub-function modules, and the AnnieJs main module is provided with a main interface, and each sub-function module is correspondingly provided with a respective calling interface, and each of the sub-function modules is respectively used to implement a function.
  • the apparatus 300 includes a first invoking unit 310, a second invoking unit 320, and a loading unit 330.
  • the first calling unit 310 is configured to invoke the resource file in a page to be displayed.
  • the packaging tool can be a webpack.
  • the second invoking unit 320 is configured to invoke a target sub-function module required by the page to be displayed in the sub-function module by calling a main interface of the AnnieJs main module introduced in the resource file.
  • the second invoking unit 320 may include a introducing subunit 321 and a second invoking subunit 322.
  • the sub-unit 321 is introduced to invoke the target sub-function module required by the page to be displayed in the sub-function module by calling the main interface of the local AnnieJs main module in the resource file.
  • the second calling sub-unit 322 is configured to acquire an ID code corresponding to the target sub-function module, and invoke the target sub-function module corresponding to the corresponding ID code.
  • the loading unit 330 is configured to load a function corresponding to the target sub-function module in the page to be displayed.
  • Each of the above units may be implemented by software code.
  • each unit described above may be stored in the memory 102.
  • the above units can also be implemented by hardware such as an integrated circuit chip.
  • the page loading device 300 provided by the embodiment of the present invention has the same implementation principle and technical effects as the foregoing method embodiments. For a brief description, where the device embodiment is not mentioned, reference may be made to the corresponding content in the foregoing method embodiments.
  • Embodiments of the present invention provide a storage medium storing program code executable by a processor, the program code being configured to cause the processor to execute the page loading method described above.
  • each block of the flowchart or block diagram can represent a module, a program segment, or a portion of code that includes one or more of the Executable instructions. It should also be noted that, in some alternative implementations, the functions noted in the blocks may also occur in a different order than those illustrated in the drawings.
  • each block of the block diagrams and/or flowcharts, and combinations of blocks in the block diagrams and/or flowcharts can be implemented in a dedicated hardware-based system that performs the specified function or action. Or it can be implemented by a combination of dedicated hardware and computer instructions.
  • each functional module in each embodiment of the present invention may be integrated to form a separate part, or each module may exist separately, or two or more modules may be integrated to form a separate part.
  • the functions, if implemented in the form of software functional modules and sold or used as separate products, may be stored in a computer readable storage medium.
  • the technical solution of the present invention which is essential or contributes to the prior art, or a part of the technical solution, may be embodied in the form of a software product, which is stored in a storage medium, including
  • the instructions are used to cause a computer device (which may be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention.
  • the foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and the like. .

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Stored Programmes (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

A page loading method and apparatus, an electronic device and a storage medium, relating to the technical field of the Internet, and being applied to resources obtained by means of a packing tool, wherein the resources comprise self-defined resource files, a preset AnnieJs main module is introduced into the resource files, the AnnieJs main module comprises a plurality of sub-functional modules, the AnnieJs main module is provided with a main interface, and the sub-functional modules are correspondingly provided with respective invoking interfaces. The method comprises: invoking a resource file in a page to be displayed (S200); by means of invoking a main interface of an AnnieJs main module introduced in the resource file, invoking a target sub-functional module required for the page to be displayed in a sub-functional module (S210); and loading a function corresponding to the target sub-functional module in the page to be displayed (S220), thereby reducing resource requests and optimizing the page loading performance by introducing the AnnieJs main module into the resource file invoked in the page to be displayed.

Description

页面加载方法、装置、电子设备及存储介质Page loading method, device, electronic device and storage medium
交互参考Cross reference
本申请要求以下优先权:2017年9月15日提出的申请号:201710837894.3,名称:“页面加载方法、装置、电子设备及存储介质”的中国专利,本申请参考引用了如上所述申请的全部内容。The present application claims the following priority: Application No.: 201710837894.3, entitled "Page Loading Method, Apparatus, Electronic Device, and Storage Medium", which is hereby incorporated by reference. content.
技术领域Technical field
本发明涉及互联网技术领域,具体而言,涉及一种页面加载方法、装置、电子设备及存储介质。The present invention relates to the field of Internet technologies, and in particular, to a page loading method, apparatus, electronic device, and storage medium.
背景技术Background technique
AnnieJs为一款专注于Html5互动交互的2d动画引擎。Webpack为一种模块加载器兼通过打包工具。webpack把AnnieJs引入并打包进最后的资源文件中,以实现页面加载。但是目前仅支持script标签来引入AnnieJs,页面会多一个资源请求,页面加载消耗的时间长。AnnieJs is a 2d animation engine that focuses on Html5 interactive interaction. Webpack is a module loader and a packaging tool. Webpack introduces and packages AnnieJs into the final resource file for page loading. However, currently only the script tag is supported to introduce AnnieJs, the page will have one more resource request, and the page load takes a long time.
发明内容Summary of the invention
有鉴于此,本发明实施例的目的在于提供一种页面加载方法、装置、电子设备及存储介质,以改善上述问题。为了实现上述目的,本发明采取的技术方案如下:In view of this, an object of embodiments of the present invention is to provide a page loading method, apparatus, electronic device, and storage medium to improve the above problems. In order to achieve the above object, the technical solution adopted by the present invention is as follows:
第一方面,本发明实施例提供了一种页面加载方法,应用于通过打包工具得到的资源,所述资源包括自定义的资源文件,所述资源文件中引入有预设的AnnieJs主模块,所述AnnieJs主模块包括多个子功能模块,所述AnnieJs主模块设置有主接口,每个子功能模块对应设置有各自的调用接口,每个所述子功能模块分别用于实现一种功能,所述方法包括:在待显示页面中调用所述资源文件;通过调用所述资源文件中引入的AnnieJs主模块的主接口,调用所述子功能模块中所述待显示页面所需的目标子功能模块;在所述待显示页面中加载所述目标子功能模块对应的功能。In a first aspect, an embodiment of the present invention provides a page loading method, which is applied to a resource obtained by a packaging tool, where the resource includes a customized resource file, and a preset main module of AnnieJs is introduced in the resource file. The main module of the AnnieJs includes a plurality of sub-function modules, the main module of the AnnieJs is provided with a main interface, and each sub-function module is correspondingly provided with a respective calling interface, and each of the sub-function modules is respectively used to implement a function, the method The method includes: calling the resource file in a page to be displayed; calling a target sub-function module required by the page to be displayed in the sub-function module by calling a main interface of an AnnieJs main module introduced in the resource file; Loading a function corresponding to the target sub-function module in the page to be displayed.
第二方面,本发明实施例提供了一种页面加载装置,应用于通过打包工具得到的资源,所述资源包括自定义的资源文件,所述资源文件中引入有预设的AnnieJs主模块,所述AnnieJs主模块包括多个子功能模块,所述AnnieJs主模块设置有主接口,每个子功能模块对应设置有各自的调用接口,每个所述子功能模块分别用于实现一种功能,所述装置包括第一调用单元、第二调用单元和加载单元。第一调用单元,用于在待显示页面中调用所述资源文件。第二调用单元,用于通过调用所述资源文件中引入的AnnieJs主模块的主接口,调用所述子功能模块中所述待显示页面所需的目标子功能模块。加载单元,用于在所述待显示页面中加载所述目标子功能模块对应的功能。In a second aspect, an embodiment of the present invention provides a page loading apparatus, which is applied to a resource obtained by a packaging tool, where the resource includes a customized resource file, and a preset main module of AnnieJs is introduced into the resource file. The main module of the AnnieJs includes a plurality of sub-function modules, the main module of the AnnieJs is provided with a main interface, and each sub-function module is correspondingly provided with a respective calling interface, and each of the sub-function modules is respectively used to implement a function, the device The first calling unit, the second calling unit, and the loading unit are included. a first calling unit, configured to invoke the resource file in a page to be displayed. And a second calling unit, configured to invoke a target sub-function module required by the page to be displayed in the sub-function module by calling a main interface of the AnnieJs main module introduced in the resource file. a loading unit, configured to load a function corresponding to the target sub-function module in the page to be displayed.
第三方面,本发明实施例提供了一种电子设备,所述电子设备包括处理器和存储器,所述处理器和所述存储器通过总线电连接;所述存储器用于存储程序;所述处理器,用于通过所述总线调用存储在所述存储器中的程序,执行:在待显示页面中调用资源文件;通过调用资源文件中引入的AnnieJs主模块的主接口,调用子功能模块中所述待显示页面所需的目标子功能模块;在所述待显示页面中加载所述目标子功能模块对应的功能。In a third aspect, an embodiment of the present invention provides an electronic device, where the electronic device includes a processor and a memory, the processor and the memory are electrically connected by a bus; the memory is used to store a program; the processor For calling the program stored in the memory by the bus, executing: calling a resource file in a page to be displayed; calling the sub-function module by calling a main interface of the AnnieJs main module introduced in the resource file Displaying a target sub-function module required by the page; loading a function corresponding to the target sub-function module in the to-be-displayed page.
第四方面,本发明实施例提供了一种存储介质,所述存储介质存储有处理器可执行的程序代码,所述程序代码被配置成使所述处理器执行所述方法。In a fourth aspect, an embodiment of the present invention provides a storage medium storing program code executable by a processor, the program code being configured to cause the processor to execute the method.
本发明实施例提供的一种页面加载方法、装置、电子设备及存储介质,应用于通过打包工具得到的资源,所述资源包括自定义的资源文件,所述资源文件中引入有预设的AnnieJs主模块,所述AnnieJs主模块包括多个子功能模块,所述AnnieJs主模块设置有主接口,每个子功能模块对应设置有各自的调用接口,每个所述子功能模块分别用于实现一种功能,所述方法包括:在待显示页面中调用所述资源文件;通过调用所述资源文件中引入的AnnieJs主模块的主接口,调用所述子功能模块中所述待显示页面所需的目标子功能模块;在所述待显示页面中加载所述目标子功能模块对应的功能,以此通过引入AnnieJs主模块到待显示页面调用的资源文件中,而避免通过script标签引入AnnieJs产生的资源请求,从而减少资源 请求,优化页面加载性能。The method for loading a page, the electronic device, and the storage medium are applied to the resource obtained by the packaging tool, where the resource includes a customized resource file, and the preset AnnieJs is introduced into the resource file. The main module, the AnnieJs main module includes a plurality of sub-function modules, the AnnieJs main module is provided with a main interface, and each sub-function module is correspondingly provided with a respective calling interface, and each of the sub-function modules is respectively used to implement a function. The method includes: calling the resource file in a page to be displayed; calling a target interface of the to-be-displayed page in the sub-function module by calling a main interface of an AnnieJs main module introduced in the resource file a function module; loading a function corresponding to the target sub-function module in the to-be-displayed page, thereby introducing a resource request generated by the AnnieJs through the script tag by introducing an AnnieJs main module into a resource file called by the page to be displayed, Thereby reducing resource requests and optimizing page loading performance.
本发明的其他特征和优点将在随后的说明书阐述,并且,部分地从说明书中变得显而易见,或者通过实施本发明实施例了解。本发明的目的和其他优点可通过在所写的说明书、权利要求书、以及附图中所特别指出的结构来实现和获得。Other features and advantages of the invention will be set forth in part in the description in the written description The objectives and other advantages of the invention may be realized and obtained by means of the structure particularly pointed in the appended claims.
附图说明DRAWINGS
为了更清楚地说明本发明实施例的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,应当理解,以下附图仅示出了本发明的某些实施例,因此不应被看作是对范围的限定,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他相关的附图。In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the embodiments will be briefly described below. It should be understood that the following drawings show only certain embodiments of the present invention, and therefore It should be seen as a limitation on the scope, and those skilled in the art can obtain other related drawings according to these drawings without any creative work.
图1为一种可应用于本发明实施例中的电子设备的结构框图;1 is a structural block diagram of an electronic device applicable to an embodiment of the present invention;
图2为本发明实施例提供的页面加载方法的流程图;2 is a flowchart of a page loading method according to an embodiment of the present invention;
图3为本发明实施例提供的AnnieJs主模块中的多个功能模块示意图;3 is a schematic diagram of multiple functional modules in an AnnieJs main module according to an embodiment of the present invention;
图4为本发明实施例提供的AnnieJs主模块示意图;4 is a schematic diagram of an main module of AnnieJs according to an embodiment of the present invention;
图5为本发明实施例提供的Annie引擎类的基类AObject模块的示意图;FIG. 5 is a schematic diagram of a base class AObject module of an Annie engine class according to an embodiment of the present invention; FIG.
图6为本发明实施例提供的页面加载装置的结构框图。FIG. 6 is a structural block diagram of a page loading apparatus according to an embodiment of the present invention.
具体实施方式Detailed ways
下面将结合本发明实施例中附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。通常在此处附图中描述和示出的本发明实施例的组件可以以各种不同的配置来布置和设计。因此,以下对在附图中提供的本发明的实施例的详细描述并非旨在限制要求保护的本发明的范围,而是仅仅表示本发明的选定实施例。基于本发明的实施例,本领域技术人员在没有做出创造性劳动的前提下所获得的所有其他实施例,都属于本发明保护的范围。The technical solutions in the embodiments of the present invention are clearly and completely described in the following with reference to the accompanying drawings in the embodiments of the present invention. It is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. The components of the embodiments of the invention, which are generally described and illustrated in the figures herein, may be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the invention in the claims All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative efforts are within the scope of the present invention.
应注意到:相似的标号和字母在下面的附图中表示类似项,因此,一 旦某一项在一个附图中被定义,则在随后的附图中不需要对其进行进一步定义和解释。同时,在本发明的描述中,术语“第一”、“第二”等仅用于区分描述,而不能理解为指示或暗示相对重要性。It should be noted that similar reference numerals and letters indicate similar items in the following figures, and therefore, once an item is defined in a drawing, it is not necessary to further define and explain it in the subsequent drawings. Also, in the description of the present invention, the terms "first", "second", and the like are used merely to distinguish a description, and are not to be construed as indicating or implying a relative importance.
图1示出了一种可应用于本发明实施例中的电子设备100的结构框图。如图1所示,电子设备100可以包括存储器102、存储控制器104、一个或多个(图1中仅示出一个)处理器106、外设接口108、输入输出模块110、音频模块112、显示模块114、射频模块116和页面加载装置。FIG. 1 is a block diagram showing the structure of an electronic device 100 that can be applied to an embodiment of the present invention. As shown in FIG. 1, the electronic device 100 can include a memory 102, a memory controller 104, one or more (only one shown in FIG. 1) processor 106, a peripheral interface 108, an input and output module 110, an audio module 112, The display module 114, the radio frequency module 116, and the page loading device.
存储器102、存储控制器104、处理器106、外设接口108、输入输出模块110、音频模块112、显示模块114、射频模块116各元件之间直接或间接地电连接,以实现数据的传输或交互。例如,这些元件之间可以通过一条或多条通讯总线或信号总线实现电连接。页面加载方法分别包括至少一个可以以软件或固件(firmware)的形式存储于存储器102中的软件功能模块,例如所述页面加载装置包括的软件功能模块或计算机程序。The memory 102, the memory controller 104, the processor 106, the peripheral interface 108, the input and output module 110, the audio module 112, the display module 114, and the RF module 116 are electrically connected directly or indirectly to each other to implement data transmission or Interaction. For example, these components can be electrically connected by one or more communication buses or signal buses. The page loading methods respectively include at least one software function module that can be stored in the memory 102 in the form of software or firmware, such as a software function module or a computer program included in the page loading device.
存储器102可以存储各种软件程序以及模块,如本申请实施例提供的页面加载方法及装置对应的程序指令/模块。处理器106通过运行存储在存储器102中的软件程序以及模块,从而执行各种功能应用以及数据处理,即实现本申请实施例中的页面加载方法。The memory 102 can store various software programs and modules, such as the page loading method and the program instructions/modules corresponding to the device provided by the embodiments of the present application. The processor 106 executes various function applications and data processing by running software programs and modules stored in the memory 102, that is, implementing the page loading method in the embodiment of the present application.
存储器102可以包括但不限于随机存取存储器(Random Access Memory,RAM),只读存储器(Read Only Memory,ROM),可编程只读存储器(Programmable Read-Only Memory,PROM),可擦除只读存储器(Erasable Programmable Read-Only Memory,EPROM),电可擦除只读存储器(Electric Erasable Programmable Read-Only Memory,EEPROM)等。The memory 102 can include, but is not limited to, Random Access Memory (RAM), Read Only Memory (ROM), Programmable Read-Only Memory (PROM), erasable read-only Erasable Programmable Read-Only Memory (EPROM), Electric Erasable Programmable Read-Only Memory (EEPROM), and the like.
处理器106可以是一种集成电路芯片,具有信号处理能力。上述处理器可以是通用处理器,包括中央处理器(Central Processing Unit,简称CPU)、网络处理器(Network Processor,简称NP)等;还可以是数字信号处理器(DSP)、专用集成电路(ASIC)、现成可编程门阵列(FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。其可以实现或者执行本申请实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以 是微处理器或者该处理器也可以是任何常规的处理器等。 Processor 106 can be an integrated circuit chip with signal processing capabilities. The processor may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP processor, etc.), or a digital signal processor (DSP) or an application specific integrated circuit (ASIC). ), off-the-shelf programmable gate arrays (FPGAs) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps, and logical block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general purpose processor may be a microprocessor or the processor or any conventional processor or the like.
所述外设接口108将各种输入/输入装置耦合至处理器106以及存储器102。在一些实施例中,外设接口108、处理器106以及存储控制器104可以在单个芯片中实现。在其他一些实例中,他们可以分别由独立的芯片实现。The peripheral interface 108 couples various input/input devices to the processor 106 and the memory 102. In some embodiments, peripheral interface 108, processor 106, and memory controller 104 can be implemented in a single chip. In other instances, they can be implemented by separate chips.
输入输出模块110用于提供给用户输入数据实现用户与电子设备100的交互。所述输入输出模块110可以是,但不限于,鼠标和键盘等。The input and output module 110 is configured to provide input data to the user to implement user interaction with the electronic device 100. The input and output module 110 can be, but is not limited to, a mouse, a keyboard, and the like.
音频模块112向用户提供音频接口,其可包括一个或多个麦克风、一个或者多个扬声器以及音频电路。The audio module 112 provides an audio interface to the user, which may include one or more microphones, one or more speakers, and audio circuitry.
显示模块114在电子设备100与用户之间提供一个交互界面(例如用户操作界面)或用于显示图像数据给用户参考。在本实施例中,所述显示模块114可以是液晶显示器或触控显示器。若为触控显示器,其可为支持单点和多点触控操作的电容式触控屏或电阻式触控屏等。支持单点和多点触控操作是指触控显示器能感应到来自该触控显示器上一个或多个位置处同时产生的触控操作,并将该感应到的触控操作交由处理器106进行计算和处理。The display module 114 provides an interactive interface (eg, a user interface) between the electronic device 100 and the user or for displaying image data to the user for reference. In this embodiment, the display module 114 can be a liquid crystal display or a touch display. For a touch display, it can be a capacitive touch screen or a resistive touch screen that supports single-point and multi-touch operations. Supporting single-point and multi-touch operations means that the touch display can sense simultaneous touch operations from one or more locations on the touch display, and the touch operation is transferred to the processor 106. Perform calculations and processing.
射频模块116用于接收以及发送电磁波,实现电磁波与电信号的相互转换,从而与通信网络或者其他设备进行通信。The radio frequency module 116 is configured to receive and transmit electromagnetic waves, and realize mutual conversion between electromagnetic waves and electric signals, thereby communicating with a communication network or other devices.
可以理解,图1所示的结构仅为示意,电子设备100还可包括比图1中所示更多或者更少的组件,或者具有与图1所示不同的配置。图1中所示的各组件可以采用硬件、软件或其组合实现。It can be understood that the structure shown in FIG. 1 is merely illustrative, and the electronic device 100 may further include more or less components than those shown in FIG. 1, or have a different configuration from that shown in FIG. 1. The components shown in Figure 1 can be implemented in hardware, software, or a combination thereof.
于本发明实施例中,电子设备100可以作为用户终端,或者作为服务器。用户终端可以为PC(personal computer)电脑、平板电脑、手机、笔记本电脑、智能电视、机顶盒、车载终端等终端设备。电子设备100中可以安装客户端,该客户端可以是浏览器也可以是第三方应用软件。In the embodiment of the present invention, the electronic device 100 can function as a user terminal or as a server. The user terminal can be a terminal device such as a PC (personal computer) computer, a tablet computer, a mobile phone, a notebook computer, a smart TV, a set top box, or a vehicle terminal. A client can be installed in the electronic device 100, and the client can be a browser or a third-party application.
请参阅图2,本发明实施例提供了一种页面加载方法,应用于通过打包工具得到的资源,所述资源包括自定义的资源文件,所述资源文件中引入有预设的AnnieJs主模块,所述AnnieJs主模块包括多个子功能模块,所述AnnieJs主模块设置有主接口,每个子功能模块对应设置有各自的调 用接口,每个所述子功能模块分别用于实现一种功能,所述方法包括:步骤S200、步骤S210和步骤S220。Referring to FIG. 2, an embodiment of the present invention provides a page loading method, which is applied to a resource obtained by a packaging tool, where the resource includes a customized resource file, and a preset main module of AnnieJs is introduced in the resource file. The main module of the AnnieJs includes a plurality of sub-function modules, and the main module of the AnnieJs is provided with a main interface, and each sub-function module is correspondingly provided with a respective calling interface, and each of the sub-function modules is respectively configured to implement a function, The method includes: step S200, step S210, and step S220.
步骤S200:在待显示页面中调用所述资源文件。Step S200: The resource file is called in a page to be displayed.
在本实施例中,资源文件可以为Javascript文件。所述打包工具可以为webpack。webpack为模块加载器兼通过打包工具。In this embodiment, the resource file may be a Javascript file. The packaging tool can be a webpack. Webpack is a module loader and a packaging tool.
步骤S210:通过调用所述资源文件中引入的AnnieJs主模块的主接口,调用所述子功能模块中所述待显示页面所需的目标子功能模块。Step S210: Call the target sub-function module required by the page to be displayed in the sub-function module by calling the main interface of the AnnieJs main module introduced in the resource file.
作为一种实施方式,基于步骤S210,进一步地,通过调用所述资源文件中引入存储在本地的AnnieJs主模块的主接口,调用所述子功能模块中所述待显示页面所需的目标子功能模块。As an embodiment, based on the step S210, further, by calling the main interface of the AnnieJs main module stored in the resource file, the target sub-function required for the page to be displayed in the sub-function module is called. Module.
AnnieJs为一款专注于Html5互动交互的2d动画引擎。例如,如图3所示,AnnieJs内每一个类为一个功能模块,如annie引擎类的基类AObject、事件触发类EventDispatcher、事件类Event、鼠标事件类MouseEvent、2维矩阵Matrix。多个功能模块的集合封装成AnnieJs主模块,对应有主接口,如图4所示,外部调用AnnieJs主模块对应的主接口,AnnieJs主模块内包括多个子功能模块,再通过调用所述子功能模块对应的调用接口调用所述调用接口对应的子功能模块。例如,在webpack中,可以通过require引入存储在本地的AnnieJs主模块。AnnieJs is a 2d animation engine that focuses on Html5 interactive interaction. For example, as shown in FIG. 3, each class in AnnieJs is a functional module, such as the base class AObject of the annie engine class, the event trigger class EventDispatcher, the event class Event, the mouse event class MouseEvent, and the 2-dimensional matrix Matrix. The collection of multiple function modules is encapsulated into the main module of AnnieJs, corresponding to the main interface. As shown in FIG. 4, the main interface corresponding to the main module of AnnieJs is externally called, and the main module of AnnieJs includes multiple sub-function modules, and then the sub-functions are called. The calling interface corresponding to the module calls the sub-function module corresponding to the calling interface. For example, in webpack, you can introduce the native AnnieJs main module via require.
AnnieJs可以包括多个类。每一个类对应一个功能模块。功能模块可以为实现动画功能。例如,AObject为Annie引擎类的基类。EventDispatcher为事件触发基类。Event为事件类,Annie引擎中一切事件的基类。MouseEvent为鼠标事件类。Point为点类。Matrix为2维矩阵。Rectangle为矩形类。DisplayObject为显示对象抽奖类。Bitmap为位图文件类。Shape为矢量对象类。Sprite为显示对象的容器类。ImageFrames为将img序列的内容画到canvas里。MovieClip为Annie引擎核心类。VideoPlayer为将video的内容或者是序列图画到canvas里形成连续播放的效果,以方便做交互。TextField为动态文本类。Stage为表示显示canvas内容的整个区域。ShadowFilter为投影或者发光滤镜。ColorFilter为普通变色滤镜。ColorMatrixFilter为矩阵变色滤镜。BlurFilter为模糊滤镜。CanvasRender 为Canvas渲染器。WGRender为WebGl渲染器。URLLoader为资源加载类。RESManager为资源加载管理模块。Tween为全局静态单列类。MovieClip为Annie引擎核心类中的类。AnnieJs can include multiple classes. Each class corresponds to a functional module. Function modules can be used to implement animation functions. For example, AObject is the base class for the Annie engine class. EventDispatcher triggers the base class for the event. Event is the event class, the base class for all events in the Annie engine. MouseEvent is a mouse event class. Point is a point class. Matrix is a 2-dimensional matrix. Rectangle is a rectangular class. DisplayObject is the display object lottery class. Bitmap is a bitmap file class. Shape is a vector object class. Sprite is the container class for display objects. ImageFrames draws the contents of the img sequence into the canvas. MovieClip is the core class of the Annie engine. VideoPlayer is used to form the effect of continuous playback of video content or sequence pictures into the canvas to facilitate interaction. TextField is a dynamic text class. Stage is the entire area that represents the contents of the canvas. ShadowFilter is a projection or illuminating filter. ColorFilter is a common color filter. ColorMatrixFilter is a matrix color filter. BlurFilter is a blur filter. CanvasRender is a Canvas renderer. WGRender is a WebGl renderer. URLLoader loads classes for resources. RESManager loads the management module for the resource. Tween is a global static single-column class. MovieClip is a class in the core class of the Annie engine.
步骤S220:在所述待显示页面中加载所述目标子功能模块对应的功能。Step S220: Load the function corresponding to the target sub-function module in the page to be displayed.
作为一种实施方式,基于步骤S210,进一步地,获取所述目标子功能模块对应的ID码,调用所述对应的ID码所对应的所述目标子功能模块,在所述待显示页面中加载所述目标子功能模块对应的功能。As an implementation manner, based on step S210, further acquiring an ID code corresponding to the target sub-function module, calling the target sub-function module corresponding to the corresponding ID code, and loading in the to-be-displayed page The function corresponding to the target sub-function module.
例如,如图5所示,以Annie引擎类的基类AObject为例,与它有关的逻辑都在模块内实现,每一个Aninie引擎对象都会有一个唯一的id码,基类AObject对应有一个唯一的id码,获取该id码,调用AObject模块,实现对应的功能。For example, as shown in Figure 5, taking the base class AObject of the Annie engine class as an example, the logic related to it is implemented in the module. Each Aninie engine object will have a unique id code, and the base class AObject has a unique one. The id code, get the id code, call the AObject module to implement the corresponding function.
本发明实施例提供的一种页面加载方法,应用于通过打包工具得到的资源,所述资源包括自定义的资源文件,所述资源文件中引入有预设的AnnieJs主模块,所述AnnieJs主模块包括多个子功能模块,所述AnnieJs主模块设置有主接口,每个子功能模块对应设置有各自的调用接口,每个所述子功能模块分别用于实现一种功能,所述方法包括:在待显示页面中调用所述资源文件;通过调用所述资源文件中引入的AnnieJs主模块的主接口,调用所述子功能模块中所述待显示页面所需的目标子功能模块;在所述待显示页面中加载所述目标子功能模块对应的功能,以此通过引入AnnieJs主模块到待显示页面调用的资源文件中,而避免通过script标签引入AnnieJs产生的资源请求,从而减少资源请求,优化页面加载性能。A page loading method provided by the embodiment of the present invention is applied to a resource obtained by a packaging tool, where the resource includes a customized resource file, and a preset main module of AnnieJs is introduced in the resource file, and the main module of the AnnieJs is introduced. A plurality of sub-function modules are provided, and the main module of the AnnieJs is provided with a main interface, and each sub-function module is correspondingly provided with a respective calling interface, and each of the sub-function modules is used to implement a function, and the method includes: waiting for Calling the resource file in the display page; calling the target sub-function module required for the page to be displayed in the sub-function module by calling the main interface of the main module of the AnnieJs introduced in the resource file; Loading the function corresponding to the target sub-function module in the page, thereby introducing the resource file called by the AnnieJs main module to the page to be displayed, and avoiding introducing the resource request generated by the AnnieJs through the script tag, thereby reducing the resource request and optimizing the page loading. performance.
请参阅图6,本发明实施例提供了一种页面加载装置300,应用于通过打包工具得到的资源,所述资源包括自定义的资源文件,所述资源文件中引入有预设的AnnieJs主模块,所述AnnieJs主模块包括多个子功能模块,所述AnnieJs主模块设置有主接口,每个子功能模块对应设置有各自的调用接口,每个所述子功能模块分别用于实现一种功能,Referring to FIG. 6 , an embodiment of the present invention provides a page loading apparatus 300, which is applied to a resource obtained by a packaging tool, where the resource includes a customized resource file, and a preset main module of AnnieJs is introduced into the resource file. The AnnieJs main module includes a plurality of sub-function modules, and the AnnieJs main module is provided with a main interface, and each sub-function module is correspondingly provided with a respective calling interface, and each of the sub-function modules is respectively used to implement a function.
所述装置300包括第一调用单元310、第二调用单元320和加载单元330。The apparatus 300 includes a first invoking unit 310, a second invoking unit 320, and a loading unit 330.
第一调用单元310,用于在待显示页面中调用所述资源文件。The first calling unit 310 is configured to invoke the resource file in a page to be displayed.
所述打包工具可以为webpack。The packaging tool can be a webpack.
第二调用单元320,用于通过调用所述资源文件中引入的AnnieJs主模块的主接口,调用所述子功能模块中所述待显示页面所需的目标子功能模块。The second invoking unit 320 is configured to invoke a target sub-function module required by the page to be displayed in the sub-function module by calling a main interface of the AnnieJs main module introduced in the resource file.
第二调用单元320可以包括引入子单元321和第二调用子单元322。The second invoking unit 320 may include a introducing subunit 321 and a second invoking subunit 322.
引入子单元321,用于通过调用所述资源文件中引入存储在本地的AnnieJs主模块的主接口,调用所述子功能模块中所述待显示页面所需的目标子功能模块。The sub-unit 321 is introduced to invoke the target sub-function module required by the page to be displayed in the sub-function module by calling the main interface of the local AnnieJs main module in the resource file.
第二调用子单元322,用于获取所述目标子功能模块对应的ID码,调用所述对应的ID码所对应的所述目标子功能模块。The second calling sub-unit 322 is configured to acquire an ID code corresponding to the target sub-function module, and invoke the target sub-function module corresponding to the corresponding ID code.
加载单元330,用于在所述待显示页面中加载所述目标子功能模块对应的功能。The loading unit 330 is configured to load a function corresponding to the target sub-function module in the page to be displayed.
以上各单元可以是由软件代码实现,此时,上述的各单元可存储于存储器102内。以上各单元同样可以由硬件例如集成电路芯片实现。Each of the above units may be implemented by software code. In this case, each unit described above may be stored in the memory 102. The above units can also be implemented by hardware such as an integrated circuit chip.
本发明实施例提供的页面加载装置300,其实现原理及产生的技术效果和前述方法实施例相同,为简要描述,装置实施例部分未提及之处,可参考前述方法实施例中相应内容。The page loading device 300 provided by the embodiment of the present invention has the same implementation principle and technical effects as the foregoing method embodiments. For a brief description, where the device embodiment is not mentioned, reference may be made to the corresponding content in the foregoing method embodiments.
本发明实施例提供了一种存储介质,所述存储介质存储有处理器可执行的程序代码,所述程序代码被配置成使所述处理器执行上述的页面加载方法。Embodiments of the present invention provide a storage medium storing program code executable by a processor, the program code being configured to cause the processor to execute the page loading method described above.
在本申请所提供的几个实施例中,应该理解到,所揭露的装置和方法,也可以通过其它的方式实现。以上所描述的装置实施例仅仅是示意性的,例如,附图中的流程图和框图显示了根据本发明的多个实施例的装置、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段或代码的一部分,所述模块、程序段或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现方式中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个连续的方 框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或动作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。In the several embodiments provided by the present application, it should be understood that the disclosed apparatus and method may also be implemented in other manners. The apparatus embodiments described above are merely illustrative, for example, the flowcharts and block diagrams in the figures illustrate the architecture, functionality, and functionality of possible implementations of apparatus, methods, and computer program products according to various embodiments of the invention. operating. In this regard, each block of the flowchart or block diagram can represent a module, a program segment, or a portion of code that includes one or more of the Executable instructions. It should also be noted that, in some alternative implementations, the functions noted in the blocks may also occur in a different order than those illustrated in the drawings. For example, two consecutive blocks may actually be executed in substantially parallel, and they may sometimes be executed in the reverse order, depending upon the functionality involved. It is also noted that each block of the block diagrams and/or flowcharts, and combinations of blocks in the block diagrams and/or flowcharts, can be implemented in a dedicated hardware-based system that performs the specified function or action. Or it can be implemented by a combination of dedicated hardware and computer instructions.
另外,在本发明各个实施例中的各功能模块可以集成在一起形成一个独立的部分,也可以是各个模块单独存在,也可以两个或两个以上模块集成形成一个独立的部分。In addition, each functional module in each embodiment of the present invention may be integrated to form a separate part, or each module may exist separately, or two or more modules may be integrated to form a separate part.
所述功能如果以软件功能模块的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。The functions, if implemented in the form of software functional modules and sold or used as separate products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention, which is essential or contributes to the prior art, or a part of the technical solution, may be embodied in the form of a software product, which is stored in a storage medium, including The instructions are used to cause a computer device (which may be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and the like. . It should be noted that, in this context, relational terms such as first and second are used merely to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply these entities or operations. There is any such actual relationship or order between them. Furthermore, the term "comprises" or "comprises" or "comprises" or any other variations thereof is intended to encompass a non-exclusive inclusion, such that a process, method, article, or device that comprises a plurality of elements includes not only those elements but also Other elements, or elements that are inherent to such a process, method, item, or device. An element that is defined by the phrase "comprising a ..." does not exclude the presence of additional equivalent elements in the process, method, item, or device that comprises the element.
以上所述仅为本发明的优选实施例而已,并不用于限制本发明,对于本领域的技术人员来说,本发明可以有各种更改和变化。凡在本发明的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。应注意到:相似的标号和字母在下面的附图中表示类似 项,因此,一旦某一项在一个附图中被定义,则在随后的附图中不需要对其进行进一步定义和解释。The above description is only the preferred embodiment of the present invention, and is not intended to limit the present invention, and various modifications and changes can be made to the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and scope of the present invention are intended to be included within the scope of the present invention. It should be noted that similar reference numerals and letters indicate similar items in the following figures, and therefore, once an item is defined in a drawing, it is not necessary to further define and explain it in the subsequent drawings.
以上所述,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应所述以权利要求的保护范围为准。The above is only a specific embodiment of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily think of changes or substitutions within the technical scope of the present invention. It should be covered by the scope of the present invention. Therefore, the scope of the invention should be determined by the scope of the claims.
需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。It should be noted that, in this context, relational terms such as first and second are used merely to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply these entities or operations. There is any such actual relationship or order between them. Furthermore, the term "comprises" or "comprises" or "comprises" or any other variations thereof is intended to encompass a non-exclusive inclusion, such that a process, method, article, or device that comprises a plurality of elements includes not only those elements but also Other elements, or elements that are inherent to such a process, method, item, or device. An element that is defined by the phrase "comprising a ..." does not exclude the presence of additional equivalent elements in the process, method, item, or device that comprises the element.

Claims (10)

  1. 一种页面加载方法,其特征在于,应用于通过打包工具得到的资源,所述资源包括自定义的资源文件,所述资源文件中引入有预设的AnnieJs主模块,所述AnnieJs主模块包括多个子功能模块,所述AnnieJs主模块设置有主接口,每个子功能模块对应设置有各自的调用接口,每个所述子功能模块分别用于实现一种功能,所述方法包括:A page loading method is characterized in that it is applied to a resource obtained by a packaging tool, the resource includes a customized resource file, and a preset main module of AnnieJs is introduced in the resource file, and the main module of the AnnieJs includes a plurality of a sub-function module, the main module of the AnnieJs is provided with a main interface, and each sub-function module is correspondingly provided with a respective calling interface, and each of the sub-function modules is used to implement a function, the method includes:
    在待显示页面中调用所述资源文件;Invoking the resource file in a page to be displayed;
    通过调用所述资源文件中引入的AnnieJs主模块的主接口,调用所述子功能模块中所述待显示页面所需的目标子功能模块;Calling a target sub-function module required for the page to be displayed in the sub-function module by calling a main interface of the AnnieJs main module introduced in the resource file;
    在所述待显示页面中加载所述目标子功能模块对应的功能。Loading a function corresponding to the target sub-function module in the page to be displayed.
  2. 根据权利要求1所述的方法,其特征在于,通过调用所述资源文件中引入的AnnieJs主模块的主接口,调用所述子功能模块中所述待显示页面所需的目标子功能模块包括:The method according to claim 1, wherein the target sub-function module required to invoke the page to be displayed in the sub-function module by calling the main interface of the main module of the AnnieJs introduced in the resource file comprises:
    通过调用所述资源文件中引入存储在本地的AnnieJs主模块的主接口,调用所述子功能模块中所述待显示页面所需的目标子功能模块。The target sub-function module required for the page to be displayed in the sub-function module is invoked by calling the main interface of the local AnnieJs main module in the resource file.
  3. 根据权利要求1所述的方法,其特征在于,所述调用所述子功能模块中所述待显示页面所需的目标子功能模块包括:The method according to claim 1, wherein the target sub-function module required to invoke the page to be displayed in the sub-function module comprises:
    获取所述目标子功能模块对应的ID码,调用所述对应的ID码所对应的所述目标子功能模块。Obtaining an ID code corresponding to the target sub-function module, and calling the target sub-function module corresponding to the corresponding ID code.
  4. 根据权利要求1所述的方法,其特征在于,所述打包工具为webpack。The method of claim 1 wherein the packaging tool is a webpack.
  5. 一种页面加载装置,其特征在于,应用于通过打包工具得到的资源,所述资源包括自定义的资源文件,所述资源文件中引入有预设的AnnieJs主模块,所述AnnieJs主模块包括多个子功能模块,所述AnnieJs主模块设置有主接口,每个子功能模块对应设置有各自的调用接口,每个所述子功能模块 分别用于实现一种功能,所述装置包括:A page loading device is characterized in that it is applied to a resource obtained by a packaging tool, the resource includes a customized resource file, and a preset AnnieJs main module is introduced in the resource file, and the AnnieJs main module includes multiple a sub-function module, the main module of the AnnieJs is provided with a main interface, and each sub-function module is correspondingly provided with a respective calling interface, and each of the sub-function modules is used to implement a function, and the device comprises:
    第一调用单元,用于在待显示页面中调用所述资源文件;a first calling unit, configured to invoke the resource file in a page to be displayed;
    第二调用单元,用于通过调用所述资源文件中引入的AnnieJs主模块的主接口,调用所述子功能模块中所述待显示页面所需的目标子功能模块;a second calling unit, configured to invoke a target sub-function module required by the page to be displayed in the sub-function module by calling a main interface of the AnnieJs main module introduced in the resource file;
    加载单元,用于在所述待显示页面中加载所述目标子功能模块对应的功能。a loading unit, configured to load a function corresponding to the target sub-function module in the page to be displayed.
  6. 根据权利要求5所述的装置,其特征在于,所述第二调用单元包括:The apparatus according to claim 5, wherein said second invoking unit comprises:
    引入子单元,用于通过调用所述资源文件中引入存储在本地的AnnieJs主模块的主接口,调用所述子功能模块中所述待显示页面所需的目标子功能模块。The sub-unit is introduced to invoke the target sub-function module required for the page to be displayed in the sub-function module by calling the main interface of the local AnnieJs main module in the resource file.
  7. 根据权利要求5所述的装置,其特征在于,所述第二调用单元还包括:The device according to claim 5, wherein the second invoking unit further comprises:
    第二调用子单元,用于获取所述目标子功能模块对应的ID码,调用所述对应的ID码所对应的所述目标子功能模块。And a second calling subunit, configured to acquire an ID code corresponding to the target sub-function module, and invoke the target sub-function module corresponding to the corresponding ID code.
  8. 根据权利要求5所述的装置,其特征在于,所述打包工具为webpack。The apparatus of claim 5 wherein said packaging tool is a webpack.
  9. 一种电子设备,其特征在于,所述电子设备包括处理器和存储器,所述处理器和所述存储器通过总线电连接;所述存储器用于存储程序;所述处理器,用于通过所述总线调用存储在所述存储器中的程序,执行:An electronic device, comprising: a processor and a memory, the processor and the memory are electrically connected by a bus; the memory is for storing a program; the processor is configured to pass the The bus calls a program stored in the memory and executes:
    在待显示页面中调用资源文件;Calling a resource file in the page to be displayed;
    通过调用资源文件中引入的AnnieJs主模块的主接口,调用子功能模块中所述待显示页面所需的目标子功能模块;Calling the target sub-function module required by the page to be displayed in the sub-function module by calling the main interface of the AnnieJs main module introduced in the resource file;
    在所述待显示页面中加载所述目标子功能模块对应的功能。Loading a function corresponding to the target sub-function module in the page to be displayed.
  10. 一种存储介质,其特征在于,所述存储介质存储有处理器可执行的程序代码,所述程序代码被配置成使所述处理器执行如权利要求1-4任一项所述方法。A storage medium, characterized in that the storage medium stores program code executable by a processor, the program code being configured to cause the processor to perform the method of any one of claims 1-4.
PCT/CN2018/104784 2017-09-15 2018-09-10 Page loading method and apparatus, electronic device and storage medium WO2019052417A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710837894.3A CN107506483A (en) 2017-09-15 2017-09-15 Page loading method, device, electronic equipment and storage medium
CN201710837894.3 2017-09-15

Publications (1)

Publication Number Publication Date
WO2019052417A1 true WO2019052417A1 (en) 2019-03-21

Family

ID=60696707

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/104784 WO2019052417A1 (en) 2017-09-15 2018-09-10 Page loading method and apparatus, electronic device and storage medium

Country Status (2)

Country Link
CN (1) CN107506483A (en)
WO (1) WO2019052417A1 (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107506483A (en) * 2017-09-15 2017-12-22 广州优视网络科技有限公司 Page loading method, device, electronic equipment and storage medium
CN109408107B (en) * 2018-10-09 2022-06-21 深圳点猫科技有限公司 Method for improving retrieval speed based on education system and electronic equipment
CN109614162B (en) * 2018-11-15 2023-10-10 福建天泉教育科技有限公司 Front-end loading optimization method based on component development mode and storage medium
CN111273947B (en) * 2018-12-05 2023-06-06 富联国基(上海)电子有限公司 Method for optimizing waiting time of user interface and electronic device
CN111061974A (en) * 2019-11-26 2020-04-24 贝壳技术有限公司 Client page loading method and device and page loading method and system

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102810065A (en) * 2011-05-31 2012-12-05 国际商业机器公司 Method and system for loading program modules
CN104270447A (en) * 2014-10-09 2015-01-07 浪潮通用软件有限公司 Method for synchronous modular loading of content on html page
CN106648794A (en) * 2016-12-29 2017-05-10 金蝶软件(中国)有限公司 Component loading method and device
CN106951271A (en) * 2017-04-18 2017-07-14 北京思特奇信息技术股份有限公司 A kind of module loading method and system based on JavaScript
CN107506483A (en) * 2017-09-15 2017-12-22 广州优视网络科技有限公司 Page loading method, device, electronic equipment and storage medium

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105530297B (en) * 2015-12-11 2019-03-08 北京奇虎科技有限公司 A kind of web page resources wrap transmission method and device
CN106790687A (en) * 2017-02-17 2017-05-31 和创(北京)科技股份有限公司 Webpage display method, web data processing method and server
CN106874494A (en) * 2017-02-23 2017-06-20 山东浪潮云服务信息科技有限公司 A kind of front end exhibiting method for being applied to visitor's preference analysis

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102810065A (en) * 2011-05-31 2012-12-05 国际商业机器公司 Method and system for loading program modules
CN104270447A (en) * 2014-10-09 2015-01-07 浪潮通用软件有限公司 Method for synchronous modular loading of content on html page
CN106648794A (en) * 2016-12-29 2017-05-10 金蝶软件(中国)有限公司 Component loading method and device
CN106951271A (en) * 2017-04-18 2017-07-14 北京思特奇信息技术股份有限公司 A kind of module loading method and system based on JavaScript
CN107506483A (en) * 2017-09-15 2017-12-22 广州优视网络科技有限公司 Page loading method, device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN107506483A (en) 2017-12-22

Similar Documents

Publication Publication Date Title
WO2019052417A1 (en) Page loading method and apparatus, electronic device and storage medium
WO2018176960A1 (en) Network picture displaying method, device and user terminal
US20210303108A1 (en) System and method for on-screen graphical user interface encapsulation and reproduction
CN110309475B (en) Page display method and device, terminal equipment and storage medium
WO2019019380A1 (en) Hybrid app page navigation method and apparatus, terminal and storage medium
CN107451244B (en) Folder naming method, mobile terminal and computer readable storage medium
JP6974604B2 (en) User interface display method and terminal device
US20150058713A1 (en) Method and apparatus for sharing media content and method and apparatus for displaying media content
WO2019056744A1 (en) Screen capturing method, device, electronic apparatus, and readable storage medium
US9996512B2 (en) Customized processing of DOM objects
WO2019134237A1 (en) Multi-page switching method, device, terminal apparatus, and storage medium
CN104850388A (en) Method and apparatus for drafting webpage
CN110795649A (en) Target page display method, device and system and electronic equipment
CN115309470B (en) Method, device, equipment and storage medium for loading widget
CN114138363A (en) Program data calling method, device, equipment and storage medium
US11438403B2 (en) Page presentation method and system, computer system, and computer readable medium
US10678561B2 (en) Virtualizing extension code in an application
CN115982491A (en) Page updating method and device, electronic equipment and computer readable storage medium
CN107341038B (en) Compatibility processing method and device and electronic equipment
CN107329654B (en) Method and device for drawing element floating layer and computer readable storage medium
CN114647411A (en) Programming interface loading method and device, electronic equipment and storage medium
CN113835790B (en) Paging page display method and device based on Android
CN113885996A (en) User interface generation method and device
CN113176907A (en) Interface data calling method and device, computer system and readable storage medium
CN110874253B (en) Display method and display system

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18855287

Country of ref document: EP

Kind code of ref document: A1