A button event processing method and device
By judging the state and type of button events, blocking asynchronous callback events, and combining time difference judgment, the shortcomings of existing anti-duplicate methods are solved, realizing flexible and efficient anti-duplicate button events, improving page interaction experience and resource utilization efficiency.
Patent Information
- Application Number
- CN202211376916.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-04
- Publication Date
- 2026-02-27
- Estimated Expiration
- 2042-11-04
AI Technical Summary
Existing button event anti-duplicate methods are ineffective in preventing duplicate clicks when the network is poor, and interactive anti-duplicate methods lack flexibility and reusability, resulting in resource waste and page lag.
By determining whether the button event is disabled, whether the anti-duplicate mechanism is triggered, and whether it is an asynchronous callback event, the system blocks the asynchronous callback event from being triggered again and unblocks it after the asynchronous callback event is completed. The system combines the time difference to determine whether the anti-duplicate mechanism is triggered, thus achieving flexibility and reusability of the anti-duplicate logic.
It improves the anti-duplicate effect of button events, supports both regular click anti-duplicate and asynchronous anti-duplicate, reduces resource waste, enhances page interaction experience, supports reusability and flexibility, and can be used directly without modifying project code.
Smart Images

Figure CN115629892B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of page operation, in particular to a button event processing method and device. BACKGROUND
[0002] At present, in the process of using various pages for production, the problem of repeated clicking frequently occurs, thereby forcing the development team to make various anti-repeating strategies for click operation. Among them, the existing anti-repeating strategies are mainly divided into two kinds: one is interface anti-repeating, and the other is interactive anti-repeating.
[0003] Among them, interface anti-repeating is only applicable to the scene when the front end and the back end interact, has limitations, and the click always triggers interface calling, which wastes resources; and interactive anti-repeating sets logical judgment on interval time, thereby eliminating the repeated use of page buttons.
[0004] In practice, the interactive anti-repeating method used by most teams has no way to determine the specific logical time consumption. Because, the interface will extend the original 1-second response time to 3 seconds when the network is poor, so that simply setting the click interval to 1 second cannot solve the anti-repeating problem. At the same time, if the click interval is set to 5 seconds at this time, the long waiting time will cause the page interaction operation to be stuck.
[0005] Therefore, it is not difficult to see that the existing method is difficult to effectively realize the effect of anti-repeating. SUMMARY
[0006] The purpose of the embodiment of the present application is to provide a button event processing method and device, which can improve the effect of anti-repeating and make the anti-repeating method for button events have certain reusability.
[0007] The first aspect of the embodiment of the present application provides a button event processing method, comprising:
[0008] When detecting that a button event is triggered, it is judged whether the button event is in a disabled triggering state;
[0009] When the button event is not in the disabled triggering state, it is judged whether the button event triggers an anti-repeating mechanism;
[0010] When the button event does not trigger the anti-repeating mechanism, it is judged whether the button event is an asynchronous callback event;
[0011] When the button event is the asynchronous callback event, the button event is blocked from being triggered again.
[0012] In the implementation process, when detecting that a button event is triggered, it is judged whether the button event is in a disabled triggering state; when the button event is not in the disabled triggering state, it is judged whether the button event triggers a prevention mechanism; when the button event does not trigger the prevention mechanism, it is judged whether the button event is an asynchronous callback event; when the button event is the asynchronous callback event, the button event is blocked from being triggered again. It can be seen that, by implementing this embodiment, the effect of the prevention can be improved, and the prevention method for the button event has a certain reusability.
[0013] Further, after the step of blocking the button event from being triggered again, the method further includes:
[0014] When the asynchronous callback event is executed, the blocking of the button event from being triggered again is cancelled.
[0015] Further, after the step of blocking the button event from being triggered again, the method further includes:
[0016] After a preset blocking duration, the blocking of the button event from being triggered again is cancelled.
[0017] When a new asynchronous event is detected, it is judged whether the asynchronous callback event is executed.
[0018] When the asynchronous callback event is executed, the new asynchronous event is executed.
[0019] Further, after the step of blocking the button event from being triggered again, the method further includes:
[0020] When the asynchronous callback event is executed, the event function of the button event is collected.
[0021] It is judged whether the event function includes a specified modifier.
[0022] When the event function includes the specified modifier, a corresponding operation is performed based on the specified modifier.
[0023] Further, the step of judging whether the button event triggers a prevention mechanism includes:
[0024] The last triggering time and the current triggering time of the button event are acquired.
[0025] The triggering time difference between the last triggering time and the current triggering time is calculated.
[0026] It is judged whether the triggering time difference is greater than a preset prevention time difference.
[0027] determining that the button event does not trigger the anti-repetition mechanism, and determining the current triggering time as the last triggering time when the triggering time difference is greater than the anti-repetition time difference.
[0028] The second aspect of the embodiment of the present application provides a button event processing device, which comprises:
[0029] a first judging unit, configured to determine whether the button event is in a disabled triggering state when detecting that the button event is triggered;
[0030] a second judging unit, configured to determine whether the button event triggers an anti-repetition mechanism when the button event is not in the disabled triggering state;
[0031] a third judging unit, configured to determine whether the button event is an asynchronous callback event when the button event does not trigger the anti-repetition mechanism;
[0032] a blocking unit, configured to block the button event from being triggered again when the button event is the asynchronous callback event.
[0033] In the implementation process, the device can determine whether the button event is in a disabled triggering state through the first judging unit when detecting that the button event is triggered, determine whether the button event triggers an anti-repetition mechanism through the second judging unit when the button event is not in the disabled triggering state, determine whether the button event is an asynchronous callback event through the third judging unit when the button event does not trigger the anti-repetition mechanism, and block the button event from being triggered again through the blocking unit when the button event is the asynchronous callback event. It can be seen that the implementation of this embodiment can improve the effect of anti-repetition and make the anti-repetition method for the button event have certain reusability.
[0034] Further, the button event processing device further comprises:
[0035] a canceling unit, configured to cancel the blocking of the button event from being triggered again when the asynchronous callback event is executed.
[0036] Further, the button event processing device further comprises:
[0037] a canceling unit, configured to cancel the blocking of the button event from being triggered again after a preset blocking duration;
[0038] a fourth judging unit, configured to determine whether the asynchronous callback event is executed when detecting a new asynchronous event;
[0039] an executing unit, configured to execute the new asynchronous event when the asynchronous callback event is executed.
[0040] Further, the button event processing apparatus further comprises:
[0041] a collecting unit configured to collect an event function of the button event when the asynchronous callback event is executed;
[0042] a fifth judging unit configured to judge whether the event function comprises a specified modifier;
[0043] an operating unit configured to perform corresponding operation based on the specified modifier when the event function comprises the specified modifier.
[0044] Further, the second judging unit comprises:
[0045] an obtaining sub-unit configured to obtain a last triggering time and a current triggering time of the button event;
[0046] a calculating sub-unit configured to calculate a triggering time difference between the last triggering time and the current triggering time;
[0047] a judging sub-unit configured to judge whether the triggering time difference is greater than a preset anti-repetition time difference;
[0048] a determining sub-unit configured to determine that the button event does not trigger the anti-repetition mechanism when the triggering time difference is greater than the anti-repetition time difference, and determine the current triggering time as the last triggering time.
[0049] The third aspect of the embodiments of the present application provides an electronic device, comprising a memory and a processor, the memory is used for storing a computer program, and the processor runs the computer program to make the electronic device execute the button event processing method in any one of the first aspect of the embodiments of the present application.
[0050] The fourth aspect of the embodiments of the present application provides a computer readable storage medium, which stores computer program instructions, when the computer program instructions are read and run by a processor, the button event processing method in any one of the first aspect of the embodiments of the present application is executed. BRIEF DESCRIPTION OF DRAWINGS
[0051] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiments of the present application. It should be understood that the following drawings only show some embodiments of the present application, and therefore should not be regarded as a limitation on the scope, and for those skilled in the art, other related drawings can also be obtained without creative labor on the basis of these drawings.
[0052] Figure 1 a flowchart of a button event processing method provided by the embodiments of the present application;
[0053] Figure 2 A flowchart of another button event processing method provided by an embodiment of the present application is shown in FIG. 1B.
[0054] Figure 3 A structural diagram of a button event processing device provided by an embodiment of the present application is shown in FIG. 2B.
[0055] Figure 4 A structural diagram of another button event processing device provided by an embodiment of the present application is shown in FIG. 3B. DETAILED DESCRIPTION
[0056] The technical solutions in the embodiments of the present application will be described below with reference to the accompanying drawings.
[0057] It should be noted that similar reference numerals and letters refer to like items in the accompanying drawings, and thus once an item is defined in one drawing, it need not be further defined and explained in subsequent drawings. Meanwhile, in the description of the present application, the terms "first", "second", and the like are merely used to distinguish description, and cannot be understood as indicating or implying relative importance.
[0058] Embodiment 1
[0059] Please refer to Figure 1 , Figure 1 A flowchart of a button event processing method provided by the present embodiment is shown in FIG. 1A. The button event processing method includes:
[0060] S101, when a button event trigger is detected, it is determined whether the button event is in a disabled trigger state, if yes, the present flowchart is ended; if no, step S102 is executed.
[0061] S102, it is determined whether the button event triggers a prevention mechanism, if yes, the present flowchart is ended; if no, step S103 is executed.
[0062] S103, it is determined whether the button event is an asynchronous callback event, if yes, step S104 is executed; if no, the present flowchart is ended.
[0063] S104, the button event is blocked from being triggered again.
[0064] As an optional implementation, after the step of blocking the button event from being triggered again, the method further includes:
[0065] After a preset blocking duration, the blocking of the button event from being triggered again is cancelled.
[0066] When a new asynchronous event is detected, it is determined whether the asynchronous callback event is executed.
[0067] When the asynchronous callback event is executed, a new asynchronous event is executed.
[0068] In the embodiment, most of the teams are currently doing click interaction anti-repetition, but it is not perfect and not universal. The imperfection is that it only makes logical judgment on the interval time, but it is not a real logical anti-repetition. For example, a certain click event logic processing needs to consume 2 seconds, and the anti-repetition interval is 1 second. Another case is when there is an asynchronous operation after clicking (such as calling an interface), the logic time in this case cannot be determined. The interface may respond in 1 second, and the network may be 3 seconds. In this case, it is unreasonable to set the click interval to 1 second and it cannot solve the problem. At the same time, if the interval time is set too long, such as 5 seconds, there is a defect in the page interaction experience. The lack of universality mainly lies in the flexibility of the anti-repetition logic in coding. It is directly controlled by a state variable in the callback method of the click event. Although this processing has clear logic, it can be said that there is no reusability for the anti-repetition logic. In order to solve this problem, the application provides a button event processing method, which specifically is a button event anti-repetition method.
[0069] In the embodiment, the execution subject of the method can be a computer, a server, or other computing devices, which are not limited in the embodiment.
[0070] In the embodiment, the execution subject of the method can also be a smart phone, a tablet computer, or other smart devices, which are not limited in the embodiment.
[0071] It can be seen that the button event processing method described in the embodiment can support ordinary click anti-repetition and asynchronous anti-repetition in the scene of processing click anti-repetition, thereby fundamentally realizing anti-repetition. At the same time, it can also more conveniently realize access, so that the existing click event method of the project can be directly used without modification, thereby perfecting the effect of anti-repetition. In addition, the method can cooperate with the loader of the anti-repetition detection to scan the click buttons in the project that do not use the anti-repetition instruction, thereby being able to discover problems in advance and timely processing.
[0072] Embodiment 2
[0073] Please refer to Figure 2 , Figure 2 The embodiment provides a flowchart of a button event processing method. The button event processing method includes:
[0074] S201, when detecting that a button event is triggered, it is judged whether the button event is in a disabled triggering state. If yes, the flowchart is ended. If no, step S202 is executed.
[0075] S202, the last triggering time and the current triggering time of the button event are acquired.
[0076] S203, calculating a trigger time difference between the last trigger time and the current trigger time.
[0077] S204, judging whether the trigger time difference is greater than a preset anti-repetition time difference, if yes, executing step S205, if not, ending the flow.
[0078] As an optional implementation, the method further comprises:
[0079] When the trigger time difference is greater than the anti-repetition time difference, it is determined that the button event does not trigger the anti-repetition mechanism, and the current trigger time is determined as the last trigger time.
[0080] S205, judging whether the button event is an asynchronous callback event, if yes, executing step S206, if not, ending the flow.
[0081] S206, blocking the button event from being triggered again.
[0082] After the step of blocking the button event from being triggered again, the method further comprises:
[0083] After a preset blocking duration, the blocking of the button event from being triggered again is cancelled;
[0084] When a new asynchronous event is detected, judging whether the asynchronous callback event is executed completely;
[0085] When the asynchronous callback event is executed completely, executing the new asynchronous event.
[0086] S207, when the asynchronous callback event is executed completely, cancelling the blocking of the button event from being triggered again.
[0087] S208, collecting an event function of the button event.
[0088] S209, judging whether the event function includes a specified modifier, if yes, executing step S210, if not, ending the flow.
[0089] S210, performing corresponding operations based on the specified modifier.
[0090] In the embodiment, the method can be applied in the financial field, and is specifically divided into two cases. The first case is that if the interval between two clicks is within the set interval time, if the asynchronous event triggered this time is earlier than the interval time, the anti-repetition is triggered; if the asynchronous event triggered this time is later than the interval time, the button can be clicked again only after the asynchronous event is completed. The second case is that when the interval between two clicks is outside the set interval time, and the click this time triggers an asynchronous event, the anti-repetition instruction can automatically determine whether the event can be triggered again according to the time when the asynchronous processing is completed.
[0091] In the embodiment, in view of the imperfection and lack of universality of the current anti-duplication, the anti-duplication instruction is created to make up for the above two defects in combination with the current VUE team. The anti-duplication instruction repairs the defect of time-based click anti-duplication in interactive design, and supports asynchronous anti-duplication at the same time. In reusability, for the code of the VUE project, the logic code of the js event callback does not need to be modified when used (if a promise is not returned in the asynchronous case, only one line of the return promise object needs to be added).
[0092] For example, the workflow of the method can be as follows:
[0093] Firstly, the method can integrate the anti-duplication instruction into the project for direct use in the VUE project through the global mixin, so that the anti-duplication interval time and scope (backup configuration: used to identify business scenarios) can be configured when the mixin is mixed.
[0094] Then, when a button on a page is clicked, it is determined whether the button is in a disabled state. If not, it is determined whether the interval time between the current click and the last click (the first time is allowed by default), and if the interval time is within the set, the anti-duplication logic is triggered, and the current click is invalid.
[0095] When the current click is valid, the callback method and parameters of the event are collected and saved, and the last click time is updated. Next, it is determined whether the callback of the current click is an asynchronous operation, and if it is an asynchronous operation, the button is marked as an asynchronous blocking state.
[0096] Finally, the button is updated to the callback end state after the callback is executed. Then, it is determined whether the button has other modifiers, such as bubbling, and if so, the current event bubbling is prevented.
[0097] In the embodiment, the execution subject of the method can be a computer, a server, or other computing devices, which are not limited in the embodiment.
[0098] In the embodiment, the execution subject of the method can also be a smart phone, a tablet computer, or other smart devices, which are not limited in the embodiment.
[0099] As can be seen, by implementing the button event processing method described in the embodiment, ordinary click anti-duplication and asynchronous anti-duplication can be supported in the scene of processing click anti-duplication, so that anti-duplication can be fundamentally realized. At the same time, it can also be more convenient to realize access, so that the existing click event method of the project can be directly used without modification, thereby perfecting the effect of anti-duplication. In addition, the method can cooperate with the anti-duplication detection loader to scan the click buttons in the project that do not use the anti-duplication instruction, so that problems can be found in advance and handled in time.
[0100] Embodiment 3
[0101] Referring to Figure 3 , Figure 3 A structure schematic diagram of a button event processing device provided in the embodiment is shown in FIG. 3. As shown in the figure, the button event processing device comprises: Figure 3
[0102] A first judging unit 310, configured to judge whether the button event is in a disabled triggering state when detecting triggering of the button event;
[0103] A second judging unit 320, configured to judge whether the button event triggers a defense mechanism when the button event is not in the disabled triggering state;
[0104] A third judging unit 330, configured to judge whether the button event is an asynchronous callback event when the button event does not trigger the defense mechanism;
[0105] A blocking unit 340, configured to block triggering of the button event again when the button event is the asynchronous callback event.
[0106] In the embodiment, the button event processing device can be explained and described according to the description in Embodiment 1, and the description will not be repeated herein.
[0107] It can be seen that the button event processing device described in the embodiment can support ordinary click defense and asynchronous defense in the scene of processing click defense, thereby fundamentally realizing defense. Meanwhile, the device can more conveniently realize access, so that the existing click event device of a project can be directly used without modification, thereby perfecting the effect of defense. In addition, the device can cooperate with a loader for defense detection to scan a click button without using a defense instruction in the project, thereby discovering problems in advance and processing them in time.
[0108] Embodiment 4
[0109] Referring to Figure 4 , Figure 4 A structure schematic diagram of a button event processing device provided in the embodiment is shown in FIG. 3. As shown in the figure, the button event processing device comprises: Figure 4
[0110] A first judging unit 310, configured to judge whether the button event is in a disabled triggering state when detecting triggering of the button event;
[0111] A second judging unit 320, configured to judge whether the button event triggers a defense mechanism when the button event is not in the disabled triggering state;
[0112] The third judging unit 330 is configured to judge whether the button event is an asynchronous callback event when the button event does not trigger the anti-repetition mechanism.
[0113] The blocking unit 340 is configured to block the button event from being triggered again when the button event is the asynchronous callback event.
[0114] As an optional implementation, the button event processing apparatus further comprises:
[0115] The canceling unit 350 is configured to cancel the blocking of the button event from being triggered again when the asynchronous callback event is executed.
[0116] As an optional implementation, the button event processing apparatus further comprises:
[0117] The canceling unit 350 is configured to cancel the blocking of the button event from being triggered again after a preset blocking duration.
[0118] The fourth judging unit 360 is configured to judge whether the asynchronous callback event is executed when a new asynchronous event is detected.
[0119] The executing unit 370 is configured to execute the new asynchronous event when the asynchronous callback event is executed.
[0120] As an optional implementation, the button event processing apparatus further comprises:
[0121] The collecting unit 380 is configured to collect an event function of the button event when the asynchronous callback event is executed.
[0122] The fifth judging unit 390 is configured to judge whether the event function includes a specified modifier.
[0123] The operating unit 400 is configured to perform a corresponding operation based on the specified modifier when the event function includes the specified modifier.
[0124] As an optional implementation, the second judging unit 320 comprises:
[0125] The obtaining sub-unit 321 is configured to obtain a last triggering time and a current triggering time of the button event.
[0126] The calculating sub-unit 322 is configured to calculate a triggering time difference between the last triggering time and the current triggering time.
[0127] The judging sub-unit 323 is configured to judge whether the triggering time difference is greater than a preset anti-repetition time difference.
[0128] The determining sub-unit 324 is configured to determine that the button event does not trigger the anti-repetition mechanism when the triggering time difference is greater than the anti-repetition time difference, and determine the current triggering time as the last triggering time.
[0129] In this embodiment, the explanation of the button event processing device can refer to the description in Embodiment 1, and no further description is given in this embodiment.
[0130] It can be seen that the button event processing device described in this embodiment can support ordinary click prevention and asynchronous prevention in the processing of click prevention, thereby fundamentally realizing click prevention. Meanwhile, the device can also facilitate access, so that the existing click event device of a project can be directly used without modification, thereby improving the effect of click prevention. In addition, the device can also cooperate with the loader for detecting click prevention to scan the click buttons in the project that do not use the click prevention instruction, thereby discovering problems in advance and processing them in time.
[0131] The electronic device provided in the embodiments of the present application includes a memory and a processor, the memory is used to store a computer program, and the processor runs the computer program to enable the electronic device to execute the button event processing method in Embodiment 1 or Embodiment 2 of the present application.
[0132] The computer readable storage medium provided in the embodiments of the present application stores computer program instructions, and the computer program instructions are read and run by a processor to execute the button event processing method in Embodiment 1 or Embodiment 2 of the present application.
[0133] In the several embodiments provided in the present application, it should be understood that the disclosed device and method can also be implemented by other manners. The device embodiments described above are only schematic, for example, the flowchart and block diagram in the drawings show the possible implementation architecture, function and operation of the device, method and computer program product according to the embodiments of the present application. In this regard, each block in the flowchart or block diagram can represent a module, a program segment or a part of code, which contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions noted in the blocks can occur in different orders from those described in the drawings. For example, two consecutive blocks can actually be executed substantially in parallel, and sometimes they can be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and the combination of blocks in the block diagram and / or flowchart, can be implemented by a dedicated hardware-based system that performs the specified function or action, or can be implemented by a combination of special-purpose hardware and computer instructions.
[0134] In addition, each functional module in the embodiments of the present application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0135] The functions described can be implemented in software, firmware, hardware, or any combination thereof. If implemented in software, the functions can be stored or transmitted over as one or more instructions or code on a computer-readable medium. Computer-readable media include both computer storage media and communication media including any medium that facilitates transfer of a computer program from one place to another. A storage medium can be any available medium that can be accessed by a general purpose or special purpose computer. By way of example, and not limitation, such computer-readable media can comprise RAM, ROM, EEPROM, CD-ROM or other optical disk storage, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to carry or store desired program code means in the form of instructions or data structures and that can be accessed by a general-purpose or special-purpose computer, or a general-purpose or special-purpose processor. Also, any connection is properly termed a computer-readable medium. For example, if the software is transmitted from a website, server, or other remote source using a coaxial cable, fiber optic cable, twisted pair, digital subscriber line (DSL), or other
[0136] The specific embodiments of the present application have been described above. However, any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present application shall fall within the scope of the present application. It should be noted that similar reference numerals and letters represent similar items in the following drawings, and thus, once an item is defined in one drawing, it need not be further defined and explained in subsequent drawings.
[0137] The specific embodiments of the present application have been described above. However, any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present application shall fall within the scope of the present application. It should be noted that similar reference numerals and letters represent similar items in the following drawings, and thus, once an item is defined in one drawing, it need not be further defined and explained in subsequent drawings.
[0138] It should be noted that the relational terms herein such as first and second and the like are used solely to distinguish one from another entity or action without necessarily requiring or implying any actual relationship or order between such entities or actions. Moreover, the terms "comprises", "comprising", or any other variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without limitation, an element preceded by "comprises... a" does not, without more constraints, foreclose the existence of additional identical elements in the process, method, article, or apparatus that comprises the element.
Claims
1. A button event handling method, characterized in that, include: When a button event is detected, it is determined whether the button event is in a disabled triggering state. When the button event is not in the disabled triggering state, determine whether the button event triggers the anti-duplicate mechanism; When the button event does not trigger the anti-duplicate mechanism, determine whether the button event is an asynchronous callback event; When the button event is the asynchronous callback event, the button event is blocked from being triggered again; After a preset blocking duration, the blocking of the button event being triggered again is canceled; When a new asynchronous event is detected, it is determined whether the asynchronous callback event has been executed. When the asynchronous callback event has finished executing, the new asynchronous event is executed; The new asynchronous event will not be executed if the asynchronous callback event has not been completed.
2. The button event handling method according to claim 1, characterized in that, After the step of blocking the button event from triggering again, the method further includes: When the asynchronous callback event is completed, the blocking of the button event from being triggered again is lifted.
3. The button event handling method according to claim 1, characterized in that, After the step of blocking the button event from triggering again, the method further includes: When the asynchronous callback event has finished executing, collect the event function of the button event; Determine whether the event function includes the specified modifier; When the event function includes the specified modifier, the corresponding operation is performed based on the specified modifier.
4. The button event handling method according to claim 1, characterized in that, The step of determining whether the button event triggers the anti-duplicate mechanism includes: Get the last trigger time and the current trigger time of the button event; Calculate the trigger time difference between the previous trigger time and the current trigger time; Determine whether the trigger time difference is greater than the preset anti-repetition time difference; When the trigger time difference is greater than the anti-duplicate time difference, it is determined that the button event has not triggered the anti-duplicate mechanism, and the previous trigger time is updated to the current trigger time.
5. A button event handling device, characterized in that, The button event handling device includes: The first judgment unit is used to determine whether the button event is in a disabled triggering state when a button event is detected. The second judgment unit is used to determine whether the button event triggers the anti-duplicate mechanism when the button event is not in the disabled triggering state. The third judgment unit is used to determine whether the button event is an asynchronous callback event when the button event does not trigger the anti-duplicate mechanism. A blocking unit is used to block the button event from being triggered again when the button event is the asynchronous callback event; The cancellation unit is used to cancel the blocking of the button event from being triggered again after a preset blocking time. The fourth judgment unit is used to determine whether the asynchronous callback event has been completed when a new asynchronous event is detected. An execution unit is configured to execute the new asynchronous event when the asynchronous callback event has been completed; and not execute the new asynchronous event when the asynchronous callback event has not been completed.
6. The button event handling device according to claim 5, characterized in that, The button event handling device further includes: The cancellation unit is used to cancel the blocking of the button event from being triggered again when the asynchronous callback event has been executed.
7. An electronic device, characterized in that, The electronic device includes a memory and a processor, the memory being used to store a computer program, and the processor running the computer program to cause the electronic device to perform the button event handling method according to any one of claims 1 to 4.
8. A readable storage medium, characterized in that, The readable storage medium stores computer program instructions, which, when read and executed by a processor, perform the button event handling method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Method and apparatus for preventing duplicate button pressing by user
CN101394406A
Dynamic checkout button apparatuses, methods and systems
CN106663256A