CN107729232A - A kind of script debugging method and device based on JS - Google Patents

A kind of script debugging method and device based on JS Download PDF

Info

Publication number
CN107729232A
CN107729232A CN201710887994.7A CN201710887994A CN107729232A CN 107729232 A CN107729232 A CN 107729232A CN 201710887994 A CN201710887994 A CN 201710887994A CN 107729232 A CN107729232 A CN 107729232A
Authority
CN
China
Prior art keywords
script files
server
script
debugged
files
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
CN201710887994.7A
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.)
Shenzhen Saiyi Technology Development Co Ltd
Original Assignee
Shenzhen Saiyi Technology Development 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 Shenzhen Saiyi Technology Development Co Ltd filed Critical Shenzhen Saiyi Technology Development Co Ltd
Priority to CN201710887994.7A priority Critical patent/CN107729232A/en
Publication of CN107729232A publication Critical patent/CN107729232A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • G06F11/3644Software debugging by instrumenting at runtime
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • G06F11/3632Software debugging of specific synchronisation aspects
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/34Network arrangements or protocols for supporting network services or applications involving the movement of software or configuration parameters 
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/16Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
    • H04L69/161Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields
    • H04L69/162Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields involving adaptations of sockets based mechanisms

Abstract

A kind of script debugging method based on JS provided by the invention, comprises the following steps:Web browser is opened, then the source file for the js script files for needing to debug is opened from the debugging acid of browser;Change the source file for the js script files to be debugged opened;Listen interfaces in server calls socket communications monitor js script files to be debugged;Server listens to js script files to be debugged and produces change;Server is asked by socket, and the modification information listened to is sent in server in the edit tool of corresponding js script files by send interfaces;Corresponding js script files in the information changed and edit tool that server contrast receives, operation is modified to corresponding js script files in edit tool;Editor completes, and is returned in edit tool and whether edits successful result;If edit the js script files successfully, editted to automatically update in server;If editor's failure, prompts failure cause.

Description

A kind of script debugging method and device based on JS
Technical field
The present invention relates to computer internet field, more particularly to a kind of script debugging method and device based on JS.
Background technology
With the development of internet, the interactivity of webpage design is that so to attract our major reason be that it draws to network Near interpersonal distance, the distance between people and information, the distance between people and science and technology.Interaction is special in webpage design Property, mainly realized by the program of software engineering, and JS is the Main Means for realizing webpage design interaction.JS is for webpage The effect of design is also more next big, and it enriches the presentation effect of design, technical continuous renewal, also enables designer continuous Expansion creativity, go to excavate new art form and the visual communication form of expression of interaction.
Typically before js formally applies to some webpage, it is to have to avoid and reduce bug quantity and carry out debugging to it very much Necessary, the way of debugging conventional present js is that the js files that will have been developed are deposited on the server, then utilizes browser Front end debugging acid do interactive operation, after being pinpointed the problems in interaction again with edit tool change file, after modification again Upload server covers original file.
Current js debugging is general cumbersome, and is typically unable to real-time synchronization to server when debugging Js files, once there are all operations of what fortuitous event and will restarted in midway.Even if the finally good good file of debugging Manual operation repeatedly is also required to server, it is more time-consuming.
The content of the invention
The present invention provides a kind of script debugging method and device based on JS, for solving in the prior art debugging js's Cumbersome and file is unable to the problem of real-time synchronization is to server during script.
A kind of script debugging method based on JS of the present invention, comprises the following steps:
Wherein, S1:Web browser is opened, then the js script files for needing to debug are opened from the debugging acid of browser Source file.
Wherein, S2:Change the source file for the js script files to be debugged opened.
Wherein, S3:Listen interfaces in server calls socket communications monitor js script files to be debugged.
Wherein, S4:Server listens to js script files to be debugged and produces change.
Wherein, S5:Server is asked by socket, and the modification information listened to is sent into service by send interfaces In device in the edit tool of corresponding js script files.
Wherein, S6:Corresponding js script files in the information changed and edit tool that server contrast receives, to compiling Corresponding js script files are modified operation in the instrument of collecting.
Wherein, S7:Editor completes, and is returned in edit tool and whether edits successful result;
It is operating procedure S8;
It is no, jump to step S9.
Wherein, S8:The js script files successfully, editted are edited to automatically update in server.
Wherein, S9:Editor's failure, prompts failure cause.
Wherein, step S4 includes:
Server contrast it is to be debugged it is unmodified before js script files and the js script files currently changed;And sentence It is disconnected it is to be debugged it is unmodified before js script files and the current js script files changed between it is whether variant;
It is then to illustrate that server listens to js script files to be debugged and produces change;
It is no, then illustrate that js script files to be debugged do not change, server does not hear js scripts text to be debugged Part changes.
Wherein, step S6 includes, and server is modified operation to corresponding js script files in edit tool, including right Content in js script files is increased, deleted and changed.
Wherein, editor's failure cause in step S9 is not present including target port, connects and be rejected and connect time-out.
The present invention also provides a kind of script debugging device based on JS, including:Acquiring unit, modification unit, monitoring unit, Transmitting element, edit cell and Tip element.
Wherein, acquiring unit, for obtaining the source file for the js script files to be debugged having already turned on.
Wherein, unit is changed, for changing the source file for the js script files to be debugged opened.
Wherein, whether monitoring unit, the js script files for monitoring to be debugged change.
Wherein, transmitting element, for the modification information listened to be sent into corresponding js script files in server In edit tool.
Wherein, edit cell, for being modified operation to corresponding js script files in edit tool.
Wherein, Tip element, for prompting editor's producing cause of failure.
Wherein, after the edit cell is to corresponding js script files are modified operation in edit tool, can edit Editing and processing result corresponding to being returned in instrument.
The editing and processing result includes editing successfully to fail with editor.
Wherein, the producing cause of editor's failure of the Tip element prompting is not present including target port, connects and refused Absolutely and connection is overtime.
The technical scheme that embodiments of the invention provide can include the following benefits:
For above feature, the invention provides a kind of script debugging method and system based on JS, led to by socket Whether the js script files to be debugged that the listen interfaces in letter are monitored in client browser have altered, if had altered, Modification information is sent to the volume of corresponding js script files in server by the send interfaces in then being communicated by calling socket In the instrument of collecting, the js script files in the edit tool of the modification information and js script files are contrasted, after editing successfully, will be changed Synchronizing information is on server.The advantages of present invention is using socket communications, solve in the prior art in debugging js script files During cumbersome and file be unable to the problem of real-time synchronization is to server, so as to save the development time, improve Operating efficiency.
Brief description of the drawings
Fig. 1 is the script debugging method and step schematic diagram based on JS.
Fig. 2 is the script debugging apparatus structure schematic diagram based on JS.
Embodiment
Below with reference to accompanying drawing, give the present invention further elaboration.
Embodiment 1:Accompanying drawing 1 is referred to, in the present embodiment, a kind of script debugging method based on JS of the invention, bag Include following steps:
S1:Web browser is opened, then the source for the js script files for needing to debug is opened from the debugging acid of browser File.
Reading source file can be chosen by clicking right button on webpage, keypad " F12 " can also be passed through on webpage To open js script files to be debugged, debugging of modifying.
S2:Change the source file for the js script files to be debugged opened.
Change js script files to be debugged as needed, for example, frame adjust width, adjust color at interface etc..
S3:Listen interfaces in server calls socket communications monitor js script files to be debugged.Socket is A kind of realization of " opening-read/write-closing " pattern, server and client side each safeguard one " file ", connected establishing After opening, content can be write to oneself file and reads or read other side's content for other side, file is closed at the end of communication.
S4:Server listens to js script files to be debugged and produces change.
Server is real by the source file in the js script files and client browser to be debugged stored originally in backstage Shi Jinhang is contrasted, if generation is inconsistent, proves that listening to js script files to be debugged produces change.
S5:Server is asked by socket, and the modification information listened to is sent in server by send interfaces In the edit tool of corresponding js script files.
Corresponding each js script files have its edit tool, such as EditArea in server, when server is monitored After producing change to js script files to be debugged, by the information of the change listened to, the js is sent to by send interfaces The edit tool EditArea of script file, contrast modification is carried out by EditArea.
S6:Corresponding js script files in the information changed and edit tool that server contrast receives, to editing work Corresponding js script files are modified operation in tool.
Originally there are a js script files to be debugged in server, after edit tool receives modification information, just will The js script files are opened with edit tool EditArea, and control modification information is modified.
In fact, when debugging webpage, after server listens to js script files generation modification information to be debugged, incessantly It is to send a modification information to the edit tool of js script files corresponding to server end, allows server to update at any time to be debugged Js script files, but also a modification information can be sent to the edit tool of client, the edit tool of client is same Js script files to be debugged original in the modification information received and client are contrasted, to original js pin to be debugged This document is modified, and is saved in native code library, is used for more fresh code.
S7:Editor completes, and is returned in edit tool and whether edits successful result;
It is operating procedure S8;
It is no, jump to step S9.
Generally, after the completion of editor, two kinds of returning results are had, otherwise edit successfully, otherwise editor's failure, typically In the case of, editor failure the reason for have it is a variety of, such as, target port is not present, connection is rejected and connects time-out etc..
S8:The js script files successfully, editted are edited to automatically update in server.
After edit tool in server has editted, the js script files in renewal server are directly preserved.
S9:Editor's failure, prompts failure cause.
In general failure cause has target port to be not present, and connection is rejected and connected time-out.
Further, step S4 includes:
Server contrast it is to be debugged it is unmodified before js script files and the js script files currently changed;And sentence It is disconnected it is to be debugged it is unmodified before js script files and the current js script files changed between it is whether variant;
It is then to illustrate that server listens to js script files to be debugged and produces change;
It is no, then illustrate that js script files to be debugged do not change, server does not hear js scripts text to be debugged Part changes.Whether server just change by the monitoring of endless loop always.
Further, step S6 includes, and server is modified operation to corresponding js script files in edit tool, bag Including is increased, deleted and is changed to the content in js script files.
In general is changed, and is on the one hand the new code of increase, be on the one hand delete original some codes again or Change some contents of original code.
Further, editor's failure cause in step S9 be not present including target port, connect be rejected and connect it is super When.
Further, have in the info.js script files of personal information one with regular expression to phone number Code judgement (/ ^1 [and 3 | 4 | 5 | 8] [0-9] d { 4,8 } $/.test (telephone number got)), for the first time may be in canonical Wrongly write for 11 and just uploaded server, operation when find error, thus need in compiler correct after again on Server is passed to, then refreshes browser and reruns info.js, so no matter changing a little thing will first check, write, on Pass, refresh, step repeats, time-consuming, arduously.
But if we debug js script files with socket, then likewise, in the info.js of personal information Have in script file one with regular expression to telephone number judgement (/ ^1 [and 3 | 4 | 5 | 8] [0-9] d { 4,8 } $/.test (telephone number got)), for the first time may in canonical 11 wrongly write and just upload server, found when operation Error, then now, we carry out debugging the script file using socket modes;
We can first open info.js webpage source file, be changed accordingly, and after modification, server is just monitored Webpage source file progress info.js is arrived to be changed, now, server calls send interfaces, the information of the change has been sent out It is sent in the edit tool of info.js script files corresponding to server, edit tool compares the modification information, by info.js Preserved after corresponding modification, then this script file of info.js just updates completion in server, we To see our modification result in real time, compiling, the troublesome operations of upload server repeatedly are eliminated.Meanwhile client Info.js edit tools can also receive the modification information that server listens to, and client believes the info.js control changes of local Breath is also changed and preserved accordingly, completes the renewal of local code.
Developer avoids the need for first writing code in editing machine, then upload server, brush by socket modes New browser is debugged;It can save the time, simplify operation, improve operating efficiency.
Another embodiment, the present invention also provide a kind of script debugging device based on JS, including:Acquiring unit 1, modification Unit 2, monitoring unit 3, transmitting element 4, edit cell 5 and Tip element 6.
Further, acquiring unit 1, for obtaining the source file for the js script files to be debugged having already turned on.Can be with Acquisition source file is chosen by clicking right button on webpage, can also wait to adjust to get by keypad " F12 " on webpage The js script files of examination, debugging of modifying.
Further, unit 2 is changed, for changing the source file for the js script files to be debugged opened.
Further, whether monitoring unit 3, the js script files for monitoring to be debugged change.
The js script files and client browser to be debugged that startup of server monitoring unit 3 will store originally in backstage Interior source file is contrasted in real time, if generation is inconsistent, proves that monitoring unit 3 listens to js script files production to be debugged Change more.If without inconsistent, prove without changing.
Further, transmitting element 4, for the modification information listened to be sent into corresponding js scripts text in server In the edit tool of part.
Server is listened to after source file has altered, and is just started transmitting element and is sent the modification information listened to;Service Corresponding each js script files have its edit tool, such as EditArea in device, when server listens to js to be debugged After script file produces change, by transmitting element 4 by the information of the change listened to, the volume of the js script files is sent to Instrument EditArea is collected, contrast modification is carried out by EditArea.
Further, edit cell 5, for being modified operation to corresponding js script files in edit tool.
Originally there are a js script files to be debugged, after edit tool receives modification information, service in server Device starts edit cell, the js script files is opened with edit tool EditArea, control modification information enters edlin.
Further, Tip element 6, for prompting editor's producing cause of failure.
After editor completes, startup of server Tip element 6, the return knot after the completion of editor is prompted by edit tool Fruit.For example edit successfully or fail, if it fails, then prompting failure cause.
Further, after the edit cell 5 is to corresponding js script files are modified operation in edit tool, meeting exists Editing and processing result corresponding to being returned in edit tool.
The editing and processing result includes editing successfully to fail with editor.
Further, the producing cause for editor's failure that the Tip element 6 is prompted is not present including target port, connected It is rejected and connects time-out.
The above, only presently preferred embodiments of the present invention, are not intended to limit embodiment of the present invention, and this area is general Lead to central scope and spirit of the technical staff according to the present invention, can very easily carry out corresponding flexible or modification, therefore originally The protection domain of invention should be defined by the protection domain required by claims.
It should be appreciated that the invention is not limited in the precision architecture for being described above and being shown in the drawings, and And various modifications and changes can be being performed without departing from the scope.The scope of the present invention is only limited by appended claim.

Claims (7)

  1. A kind of 1. script debugging method based on JS, it is characterised in that comprise the following steps:
    S1:Web browser is opened, then the source file for the js script files for needing to debug is opened from the debugging acid of browser;
    S2:Change the source file for the js script files to be debugged opened;
    S3:Listen interfaces in server calls socket communications monitor js script files to be debugged;
    S4:Server listens to js script files to be debugged and produces change;
    S5:Server is asked by socket, and the modification information listened to is sent in server by send interfaces and corresponded to Js script files edit tool in;
    S6:Corresponding js script files in the information changed and edit tool that server contrast receives, in edit tool Corresponding js script files are modified operation;
    S7:Editor completes, and is returned in edit tool and whether edits successful result;
    It is operating procedure S8;
    It is no, jump to step S9;
    S8:The js script files successfully, editted are edited to automatically update in server;
    S9:Editor's failure, prompts failure cause.
  2. 2. the script debugging method according to claim 1 based on JS, it is characterised in that step S4 includes:
    Server contrast it is to be debugged it is unmodified before js script files and the js script files currently changed;And judge to treat Debugging it is unmodified before js script files and the current js script files changed between it is whether variant;
    It is then to illustrate that server listens to js script files to be debugged and produces change;
    It is no, then illustrate that js script files to be debugged do not change, server does not hear js script files hair to be debugged Change more.
  3. 3. the script debugging method according to claim 1 based on JS, it is characterised in that step S6 includes, server pair Corresponding js script files are modified operation in edit tool, including the content in js script files is increased, deleted And modification.
  4. 4. the script debugging method according to claim 1 based on JS, it is characterised in that editor's failure in step S9 is former Time-out is rejected and connects because being not present, connecting including target port.
  5. A kind of 5. script debugging device based on JS, it is characterised in that including:Acquiring unit, modification unit, monitoring unit, hair Send unit, edit cell and Tip element;
    Acquiring unit, for obtaining the source file for the js script files to be debugged having already turned on;
    Unit is changed, for changing the source file for the js script files to be debugged opened;
    Whether monitoring unit, the js script files for monitoring to be debugged change;
    Transmitting element, for the modification information listened to be sent to the edit tool of corresponding js script files in server In;
    Edit cell, for being modified operation to corresponding js script files in edit tool;
    Tip element, for prompting editor's producing cause of failure.
  6. 6. the script debugging device according to claim 5 based on JS, it is characterised in that the edit cell is to editing work After corresponding js script files are modified operation in tool, meeting editing and processing result corresponding to return in edit tool;
    The editing and processing result includes editing successfully to fail with editor.
  7. 7. the script debugging device according to claim 5 based on JS, it is characterised in that the volume of the Tip element prompting The producing cause of volume failure is not present including target port, connects and be rejected and connect time-out.
CN201710887994.7A 2017-09-27 2017-09-27 A kind of script debugging method and device based on JS Pending CN107729232A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710887994.7A CN107729232A (en) 2017-09-27 2017-09-27 A kind of script debugging method and device based on JS

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710887994.7A CN107729232A (en) 2017-09-27 2017-09-27 A kind of script debugging method and device based on JS

Publications (1)

Publication Number Publication Date
CN107729232A true CN107729232A (en) 2018-02-23

Family

ID=61208072

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710887994.7A Pending CN107729232A (en) 2017-09-27 2017-09-27 A kind of script debugging method and device based on JS

Country Status (1)

Country Link
CN (1) CN107729232A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109241482A (en) * 2018-08-28 2019-01-18 优视科技新加坡有限公司 Determine that altering event issues successful method and device thereof
CN109409399A (en) * 2018-08-23 2019-03-01 深圳点猫科技有限公司 A kind of script error book of final entry method and electronic equipment based on educational system
WO2020010725A1 (en) * 2018-07-10 2020-01-16 平安科技(深圳)有限公司 Method and apparatus for automatically synchronously refreshing browser, and computer device
CN112597019A (en) * 2020-12-24 2021-04-02 上海艾融软件股份有限公司 Front-end code debugging method, device, system and medium
CN113760706B (en) * 2020-09-17 2024-05-17 北京沃东天骏信息技术有限公司 Webpage debugging method and device

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103595742A (en) * 2012-08-14 2014-02-19 阿里巴巴集团控股有限公司 A method and an apparatus for debugging webpage CSS
CN106997321A (en) * 2016-01-25 2017-08-01 阿里巴巴集团控股有限公司 CSS adjustment methods and device

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103595742A (en) * 2012-08-14 2014-02-19 阿里巴巴集团控股有限公司 A method and an apparatus for debugging webpage CSS
CN106997321A (en) * 2016-01-25 2017-08-01 阿里巴巴集团控股有限公司 CSS adjustment methods and device

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2020010725A1 (en) * 2018-07-10 2020-01-16 平安科技(深圳)有限公司 Method and apparatus for automatically synchronously refreshing browser, and computer device
CN109409399A (en) * 2018-08-23 2019-03-01 深圳点猫科技有限公司 A kind of script error book of final entry method and electronic equipment based on educational system
CN109241482A (en) * 2018-08-28 2019-01-18 优视科技新加坡有限公司 Determine that altering event issues successful method and device thereof
CN113760706B (en) * 2020-09-17 2024-05-17 北京沃东天骏信息技术有限公司 Webpage debugging method and device
CN112597019A (en) * 2020-12-24 2021-04-02 上海艾融软件股份有限公司 Front-end code debugging method, device, system and medium

Similar Documents

Publication Publication Date Title
CN107729232A (en) A kind of script debugging method and device based on JS
Memon An event‐flow model of GUI‐based applications for testing
CN106844217A (en) Control to applying bury method and device, readable storage medium storing program for executing a little
Lai A survey of communication protocol testing
CN110764753A (en) Business logic code generation method, device, equipment and storage medium
US9047413B2 (en) White-box testing systems and/or methods for use in connection with graphical user interfaces
CN106844204B (en) Method and system for generating defect report by using mobile terminal
CN105843734A (en) Automatic test method and device and computing device
Antoniol et al. Program understanding and maintenance with the CANTO environment
CN108228173A (en) A kind of visual data-interface development system and method
CN112882930B (en) Automatic test method and device, storage medium and electronic equipment
CN109683859B (en) Computer software development management platform, equipment and readable storage medium
CN107766509A (en) A kind of method and apparatus of webpage static backup
US20160349978A1 (en) Knowledge base studio
CN112286501A (en) Method and device for embedding point in page of terminal equipment and storage medium
CN108038241A (en) Integrated WEB visual workflows method, apparatus, readable storage medium storing program for executing and system
CN109471776A (en) A kind of vxworks operating system log collecting method based on Ethernet
CN103595742B (en) A method and an apparatus for debugging webpage CSS
CN114003451B (en) Interface testing method, device, system and medium
CN112083926A (en) Web user interface generation method and device
Amyot et al. Use Case Maps and Lotos for the prototyping and validation of a mobile group call system
Bucchiarone et al. Model-checking plus testing: from software architecture analysis to code testing
CN114925516B (en) Automatic modeling and simulating method and device
CN109344069A (en) A kind of the synergetic office work method and synergetic office work platform of software automated testing
CN104732341A (en) Control method and control system for simulating service process and service process operation

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
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20180223

WD01 Invention patent application deemed withdrawn after publication