Looking for breakthrough ideas for innovation challenges? Try Patsnap Eureka!

Multi-thread two-dimensional code generation algorithm based on Web Workers

A generation algorithm and technology of two-dimensional code, applied in the field of two-dimensional code generation, can solve the problems of increasing HTML page response time, browser suspended animation, etc.

Inactive Publication Date: 2020-10-20
汪金玲
View PDF0 Cites 3 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

The JavaScript-based two-dimensional code generation algorithm can generate two-dimensional codes without the help of third-party libraries or plug-ins, but because JavaScript is executed in a single thread, the JavaScript engine cannot execute other codes when it is cumbersome or has a large amount of calculation. JavaScript scripts, while the GUI rendering thread of the browser will also be in a waiting state, which may cause the browser to enter a state of suspended animation; the jQuery-based two-dimensional code generation algorithm can generate two-dimensional codes more conveniently than the JavaScript-based algorithm. Two-dimensional code, developers only need to import jQuery library files and two-dimensional code plug-ins, set two-dimensional code parameters to generate two-dimensional codes, but because HTML pages need to load jQuery library files and two-dimensional code plug-ins to generate the required two-dimensional code code, thereby increasing the response time of HTML pages

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Multi-thread two-dimensional code generation algorithm based on Web Workers

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0056] It should be understood that the specific embodiments described here are only used to explain the present invention, not to limit the present invention.

[0057] In order to improve the utilization rate of the CPU, prevent the browser from entering a dead state, and at the same time solve the problems of the traditional two-dimensional code generation algorithm, such as low two-dimensional code generation efficiency, long system response time, and low system stability, the present invention provides a A multi-threaded QR code generation algorithm based on Web Workers. refer to figure 1 As shown, it is a schematic flowchart of a WebWorkers-based multithreaded two-dimensional code generation algorithm provided by an embodiment of the present invention.

[0058] In this embodiment, the multithreaded two-dimensional code generation algorithm based on Web Workers includes:

[0059] S1. The browser receives a two-dimensional code generation request, obtains two-dim...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The invention relates to the technical field of two-dimensional code generation, and discloses a multi-thread two-dimensional code generation algorithm based on Web Workers. The multi-thread two-dimensional code generation algorithm comprises the following steps that: a browser end receives a two-dimensional code generation request, and acquires two-dimensional code generation data according to the two-dimensional code generation request; encoding the two-dimensional code generation data, and taking the encoded data as two-dimensional code content information parameters; packaging the two-dimensional code content information parameter and a preset two-dimensional code parameter into a parameter object by usinga JavaScript main thread of the browser, and instantiating a Worker sub-thread; sending the parameter object in the JavaScript main thread to the Worker sub-thread; analyzing the received parameter object and calculating a corresponding two-dimensional code matrix by the Worker sub-thread; traversing the two-dimensional code matrix by the Worker sub-thread, and rendering the two-dimensional code by using a (rect) label of the SVG to obtain an SVG image of the two-dimensional code; and the Worker sub-thread sends the SVG image back to the JavaScript main thread, and the JavaScript main thread directly displays the two-dimensional code on an HTML page in an inline SVG mode.the multi-thread two-dimensional code generation algorithm improves the generation efficiency of the two-dimensional code.

Description

technical field [0001] The invention relates to the technical field of two-dimensional code generation, in particular to a multi-threaded two-dimensional code generation algorithm based on Web Workers. Background technique [0002] With the rapid development of the Internet and the Internet of Things and the popularity of smart terminal devices, QR codes, as an emerging information carrier and transmission tool, have also developed rapidly, playing an indispensable role in all walks of life, not only Applied in social networks, more widely used in business, payment and other service links. [0003] Two-dimensional codes record and store data information with the distribution of black and white alternating geometric figures on a two-dimensional plane according to certain design rules, and use white and black graphic symbols to represent computer The "0" and "1" binary bit streams use the black and white geometric patterns corresponding to the "0" and "1" binary to store and ...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
IPC IPC(8): G06K19/06G06F40/126G06F16/957
CPCG06K19/06037G06F16/957G06F40/126
Inventor 汪金玲
Owner 汪金玲
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Patsnap Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Patsnap Eureka Blog
Learn More
PatSnap group products