CN108804082A - A kind of implementation method of plug-in unit JSBridge - Google Patents

A kind of implementation method of plug-in unit JSBridge Download PDF

Info

Publication number
CN108804082A
CN108804082A CN201810445292.8A CN201810445292A CN108804082A CN 108804082 A CN108804082 A CN 108804082A CN 201810445292 A CN201810445292 A CN 201810445292A CN 108804082 A CN108804082 A CN 108804082A
Authority
CN
China
Prior art keywords
plug
jsbridge
units
unit
pages
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
CN201810445292.8A
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.)
Beijing Kuwo Technology Co Ltd
Original Assignee
Beijing Kuwo Technology Co Ltd
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 Beijing Kuwo Technology Co Ltd filed Critical Beijing Kuwo Technology Co Ltd
Priority to CN201810445292.8A priority Critical patent/CN108804082A/en
Publication of CN108804082A publication Critical patent/CN108804082A/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
    • 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/44505Configuring for program initiating, e.g. using registry, configuration files
    • 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
    • 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/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4482Procedural

Abstract

The present invention relates to a kind of implementation methods of plug-in unit JSBridge, include the following steps:JSBridge is divided into essential JSBridge plug-in units and optional JSBridge plug-in units by mark by business, after APP starts, when entering the H5 pages, initialization process is carried out to JSBridge, essential JSBridge plug-in units are loaded according to mark, according to the content of the H5 pages, the optional JSBridge plug-in units of its service response are related to according to mark load, it sends out initialization and finishes signal, the H5 pages are attempted to call the method in JSBridge.Native is supplied to the interface of JS by delineation of activities, and carries out plug-in unit by the present invention, is divided into essential plug-in unit and optional plug-in unit, and interface is made to be separated into each plug-in unit by business, improves operational efficiency, is facilitated debugging, is safeguarded.

Description

A kind of implementation method of plug-in unit JSBridge
Technical field
The present invention relates to the telecommunication management technical field of Native codes and JS codes, specifically a kind of plug-in unit The implementation method of JSBridge.
Background technology
Present APP is much Native and H5 mixed developings, and important module is Native exploitations, ensure that APP's Fluency and relatively good user experience;It is required that the module to timely update is H5 exploitations, and the page of such as competing, the advertising campaign page. It is that the development cycle is short with the H5 benefits developed, it can be with online updating.
H5 is the abbreviation of html5.The newest revision versions of HTML are a kind of hypertext markup language.H5 elder generations calling system Browser kernel, be the equal of being operated in webpage, it is slightly worse compared with Native stability, speed is slower.Advantage is can With cross-platform, while exploitation is easy, efficient, facilitates debugging.
Native uses native system kernel, is equivalent to and is directly operated in system, more stablizes, quickly, can use Extremely more API, therefore the function that developed is preferable.
H5 is good without pure Native in performance, and also good not as Native in experience.
JSBridge is the communication bridge of Native codes and JS codes.A kind of current unified approach is:H5 triggers url scheme->Native captures url scheme->Primary analysis, execute->Primary calling H5.
Url scheme, which are briefly exactly one, can allow the agreement that APP can be redirected between each other.Each APP's Url scheme are different, if there is the same url scheme, then system, which will respond, first installs that APP Url scheme cannot be called because the url scheme of the APP installed afterwards are capped.
JSBridge is exactly the communication for defining Native and JS(Interactive bridge), Native pass through a fixed bridge Object reference JS, JS also only pass through fixed bridge object reference Native.JS can call Native methods by JSBridge, Native can call JS methods by JSBridge.
With increasing for business, Native can provide more and more interfaces to JS, but when one page of opening, usually This page only needs to call not to need with the relevant interface of current page, other relevant interfaces of business, so there is no need to Load these interfaces, it is therefore desirable to be optimized to JSBridge, to improve operational efficiency, facilitate debugging, safeguard.
Invention content
In view of the deficiencies in the prior art, the purpose of the present invention is to provide a kind of realizations of plug-in unit JSBridge Native is supplied to the interface of JS by delineation of activities, and carries out plug-in unit by method, is divided into essential plug-in unit and optional plug-in unit, So that interface is separated into each plug-in unit by business, improve operational efficiency, facilitates debugging, safeguards.
To achieve the above objectives, the technical solution adopted by the present invention is that:
A kind of implementation method of plug-in unit JSBridge, which is characterized in that include the following steps:
JSBridge is divided into essential JSBridge plug-in units and optional JSBridge plug-in units by mark by business,
After APP starts, when entering the H5 pages, initialization process is carried out to JSBridge,
Essential JSBridge plug-in units are loaded according to mark,
According to the content of the H5 pages, the optional JSBridge plug-in units of its service response are related to according to mark load,
It sends out initialization and finishes signal,
The H5 pages are attempted to call the method in JSBridge.
Based on the above technical solution, the H5 pages attempt call JSBridge in method when, JSBridge according to Method parses its corresponding plug-in unit and realization,
The Native codes of response are executed,
The callback method for calling H5 to pass over.
Based on the above technical solution, the JSBridge plug-in units and the correspondence of business include:
JSHttpRequestPlugin plug-in units are packaged with the HTTP request interface provided to JS, for providing network request to H5 It supports,
JSUserPlugin plug-in units, be packaged with provided to JS with the relevant interface of user's operation,
JSSharePlugin plug-in units are packaged with and share relevant interface to what JS was provided, share multimedia resource branch for providing It holds,
JSCommonPlugin plug-in units are packaged with the general-purpose interface provided to JS.
Based on the above technical solution, optional JSBridge plug-in units are loaded into JSBridge by the way of mounting.
Native is supplied to the interface of JS to be drawn by business by the implementation method of plug-in unit JSBridge of the present invention Point, and plug-in unit is carried out, it is divided into essential plug-in unit and optional plug-in unit, interface is made to be separated into each plug-in unit by business, improves fortune Line efficiency facilitates debugging, safeguards.
The implementation method of plug-in unit JSBridge of the present invention, has the following advantages:
1, interface is separated by business in each plug-in unit, code is easy to maintain;
2, interface card is made optionally, operational efficiency is high;
3, possess unified entrance, facilitate debugging.
Description of the drawings
The present invention has following attached drawing:
The flow chart of Fig. 1 present invention.
Specific implementation mode
Below in conjunction with attached drawing, invention is further described in detail.
As shown in Figure 1, the implementation method of plug-in unit JSBridge of the present invention, includes the following steps:
JSBridge is divided into essential JSBridge plug-in units and optional JSBridge plug-in units by mark by business,
After APP starts, when entering the H5 pages, initialization process is carried out to JSBridge,
Essential JSBridge plug-in units are loaded according to mark,
According to the content of the H5 pages, the optional JSBridge plug-in units of its service response are related to according to mark load,
It sends out initialization and finishes signal,
The H5 pages are attempted to call the method in JSBridge.
Based on the above technical solution, the H5 pages attempt call JSBridge in method when, JSBridge according to Method parses its corresponding plug-in unit and realization,
The Native codes of response are executed,
The callback method for calling H5 to pass over.
Based on the above technical solution, the JSBridge plug-in units and the correspondence of business include:
JSHttpRequestPlugin plug-in units are packaged with the HTTP request interface provided to JS, for providing network request to H5 It supports,
JSUserPlugin plug-in units, be packaged with provided to JS with the relevant interface of user's operation,
JSSharePlugin plug-in units are packaged with and share relevant interface to what JS was provided, share multimedia resource branch for providing It holds,
JSCommonPlugin plug-in units are packaged with the general-purpose interface provided to JS.
Based on the above technical solution, the HTTP request interface provided to JS, specifically includes:The GET of http Interface, POST interfaces,
It is described to JS provide and the relevant interface of user's operation, specifically include:The individual center page interface of user is jumped to,
It is described to share relevant interface to what JS was provided, it specifically includes:Share picture interface, shares audio interface, sharing video frequency Interface,
The general-purpose interface provided to JS, specifically includes:Toast prompts interface, alert that interface, confirm bullet frames is prompted to carry Show interface, readCache interfaces, writeCache interfaces.
Based on the above technical solution, optional JSBridge plug-in units are loaded into JSBridge by the way of mounting.
Based on the above technical solution, essential JSBridge plug-in units are preset as to the JS general-purpose interfaces provided, with industry Business has relationship to be then preset as optional JSBridge plug-in units.
Such as:
This is universal card to JSCommonPlugin, is exactly essential plug-in unit, and Native, which can give tacit consent to, loads this plug-in unit, and H5 can Method to directly invoke the inside;
JSSharePlugin, is and to share business relevant that some H5 have sharing operation, some H5 not to share, so this Plug-in unit arriving just in other instances, then being just classified as optional plug-in unit.
The content not being described in detail in this specification belongs to the prior art well known to professional and technical personnel in the field.

Claims (4)

1. a kind of implementation method of plug-in unit JSBridge, which is characterized in that include the following steps:
JSBridge is divided into essential JSBridge plug-in units and optional JSBridge plug-in units by mark by business,
After APP starts, when entering the H5 pages, initialization process is carried out to JSBridge,
Essential JSBridge plug-in units are loaded according to mark,
According to the content of the H5 pages, the optional JSBridge plug-in units of its service response are related to according to mark load,
It sends out initialization and finishes signal,
The H5 pages are attempted to call the method in JSBridge.
2. the implementation method of plug-in unit JSBridge as described in claim 1, it is characterised in that:The H5 pages are attempted to call When method in JSBridge, JSBridge parses its corresponding plug-in unit and realization according to method,
The Native codes of response are executed,
The callback method for calling H5 to pass over.
3. the implementation method of plug-in unit JSBridge as described in claim 1, it is characterised in that:The JSBridge plug-in units and The correspondence of business includes:
JSHttpRequestPlugin plug-in units are packaged with the HTTP request interface provided to JS, for providing network request to H5 It supports,
JSUserPlugin plug-in units, be packaged with provided to JS with the relevant interface of user's operation,
JSSharePlugin plug-in units are packaged with and share relevant interface to what JS was provided, share multimedia resource branch for providing It holds,
JSCommonPlugin plug-in units are packaged with the general-purpose interface provided to JS.
4. the implementation method of plug-in unit JSBridge as described in claim 1, it is characterised in that:Optional JSBridge plug-in units are adopted It is loaded into JSBridge with the mode of mounting.
CN201810445292.8A 2018-05-10 2018-05-10 A kind of implementation method of plug-in unit JSBridge Pending CN108804082A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810445292.8A CN108804082A (en) 2018-05-10 2018-05-10 A kind of implementation method of plug-in unit JSBridge

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810445292.8A CN108804082A (en) 2018-05-10 2018-05-10 A kind of implementation method of plug-in unit JSBridge

Publications (1)

Publication Number Publication Date
CN108804082A true CN108804082A (en) 2018-11-13

Family

ID=64092149

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810445292.8A Pending CN108804082A (en) 2018-05-10 2018-05-10 A kind of implementation method of plug-in unit JSBridge

Country Status (1)

Country Link
CN (1) CN108804082A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109857403A (en) * 2018-12-05 2019-06-07 腾讯科技(深圳)有限公司 A kind of renewal of the page, page processing method and device
CN109901827A (en) * 2019-03-13 2019-06-18 厦门美图之家科技有限公司 Using exchange method, device, electronic equipment and readable storage medium storing program for executing
CN111782192A (en) * 2020-07-02 2020-10-16 浪潮云信息技术股份公司 Method for developing mobile office system in mixed mode
CN113360406A (en) * 2021-07-01 2021-09-07 上海哔哩哔哩科技有限公司 Method and device for testing JSbridge method of application program

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8819698B2 (en) * 2012-04-02 2014-08-26 Hewlett-Packard Development Company, L. P. Cross-platform web-based native device feature access
CN104424002A (en) * 2013-09-10 2015-03-18 中国科学院声学研究所 Dynamic component loading method and system based on plug-in mechanism
CN104714828A (en) * 2015-03-31 2015-06-17 北京奇虎科技有限公司 Methods and devices for installing and operating application
CN106502738A (en) * 2016-10-24 2017-03-15 福建中金在线信息科技有限公司 Data load method and device in a kind of mobile terminal
CN106910107A (en) * 2017-01-23 2017-06-30 武汉奇米网络科技有限公司 One kind promotion page configuration method and system
CN106970946A (en) * 2017-02-24 2017-07-21 阿里巴巴集团控股有限公司 A kind of page display method and device
CN107678801A (en) * 2017-10-09 2018-02-09 武汉斗鱼网络科技有限公司 A kind of method and apparatus of plug-in unit loading
CN107729352A (en) * 2017-08-30 2018-02-23 上海壹账通金融科技有限公司 page resource loading method and terminal device
CN107861713A (en) * 2017-07-25 2018-03-30 平安普惠企业管理有限公司 Data calling method, device and computer-readable recording medium
US9959019B1 (en) * 2013-04-23 2018-05-01 Amazon Technologies, Inc. Customizable media player framework

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8819698B2 (en) * 2012-04-02 2014-08-26 Hewlett-Packard Development Company, L. P. Cross-platform web-based native device feature access
US9959019B1 (en) * 2013-04-23 2018-05-01 Amazon Technologies, Inc. Customizable media player framework
CN104424002A (en) * 2013-09-10 2015-03-18 中国科学院声学研究所 Dynamic component loading method and system based on plug-in mechanism
CN104714828A (en) * 2015-03-31 2015-06-17 北京奇虎科技有限公司 Methods and devices for installing and operating application
CN106502738A (en) * 2016-10-24 2017-03-15 福建中金在线信息科技有限公司 Data load method and device in a kind of mobile terminal
CN106910107A (en) * 2017-01-23 2017-06-30 武汉奇米网络科技有限公司 One kind promotion page configuration method and system
CN106970946A (en) * 2017-02-24 2017-07-21 阿里巴巴集团控股有限公司 A kind of page display method and device
CN107861713A (en) * 2017-07-25 2018-03-30 平安普惠企业管理有限公司 Data calling method, device and computer-readable recording medium
CN107729352A (en) * 2017-08-30 2018-02-23 上海壹账通金融科技有限公司 page resource loading method and terminal device
CN107678801A (en) * 2017-10-09 2018-02-09 武汉斗鱼网络科技有限公司 A kind of method and apparatus of plug-in unit loading

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109857403A (en) * 2018-12-05 2019-06-07 腾讯科技(深圳)有限公司 A kind of renewal of the page, page processing method and device
CN109901827A (en) * 2019-03-13 2019-06-18 厦门美图之家科技有限公司 Using exchange method, device, electronic equipment and readable storage medium storing program for executing
CN111782192A (en) * 2020-07-02 2020-10-16 浪潮云信息技术股份公司 Method for developing mobile office system in mixed mode
CN113360406A (en) * 2021-07-01 2021-09-07 上海哔哩哔哩科技有限公司 Method and device for testing JSbridge method of application program

Similar Documents

Publication Publication Date Title
CN108804082A (en) A kind of implementation method of plug-in unit JSBridge
CN105354014B (en) Application interface renders methods of exhibiting and device
US10817350B2 (en) Method and device for starting external application program in browser
CN103309660B (en) Mobile solution cross-platform development method
CN102057654B (en) Mobile device application framework
US9571556B2 (en) Browser kernel adaptation method and browser therefor
CN103729425B (en) Operate response method, client, browser and system
CN106878361B (en) Debugging method and device for terminal application page and client
CN102291437A (en) System and method for realizing application of cross-platform internet
CN102323880A (en) Mobile phone application interface development method and terminal based on browser parsing mode
CN107918619B (en) Advertisement display method and device
CN106909361A (en) Web development approaches and device based on masterplate engine
CN102799477A (en) Resource access method and apparatus
CN103179159A (en) Method for processing third-party applications and terminal browser
CN103607454B (en) The method that android system browser arranges privately owned proxy server
EP2823411A1 (en) A method and system of application development for multiple device client platforms
CN101807204B (en) Dynamic creation method of processing Web service with remote sensing image
CN110381363A (en) Video encoding/decoding method, device, server and storage medium
CN102156650B (en) Method and device capable of implementing automatic analysis of patch
CN105138399A (en) Cross-platform mobile Web application runtime engine
CN114297549A (en) Component processing method and device
CN108228139B (en) Singlechip development system and device based on HTML5 browser frame
CN105955786B (en) A kind of implementation method of the point of sales terminal based on HTML5
CN108733388A (en) A kind of H5 page parsing methods wrapped offline based on Native
CN103793459B (en) Webpage opening method and device

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: 20181113