Request initiation method and device, equipment and medium
By combining arrow functions and timers, the system obtains and manages HTTP request paths and parameters, solving the problems of resource waste and high code complexity in web application projects, and achieving efficient HTTP request management.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ZHEJIANG BANGSUN TECH CO LTD
- Filing Date
- 2024-11-25
- Publication Date
- 2026-05-26
Smart Images

Figure CN122086532A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of application development technology, and in particular to a request initiation method, apparatus, device and medium. Background Technology
[0002] As Web (World Wide Web) applications evolve, the number of interfaces in these applications increases, making interface maintenance and invocation more complex. Traditionally, there are two approaches to initiating HTTP (Hypertext Transfer Protocol) requests with the same address but different parameters. The first approach involves directly initiating a single HTTP request based on one interface address and one set of parameters. If a page in the project needs to use N interfaces, N HTTP requests will be initiated, wasting HTTP request resources. The second approach involves using parameter tracking code to collect the addresses and parameters of N interfaces when entering a page, and then initiating a single HTTP request. While this reduces the number of HTTP requests, it requires additional parameter tracking code, increasing code complexity. Furthermore, if any interface changes, the parameter tracking code needs to be modified, further increasing maintenance difficulty. Summary of the Invention
[0003] In view of this, the purpose of this application is to provide a request initiation method, apparatus, device, and medium that can combine arrow functions, timers, and request initiation functions to send only one request when faced with different request parameters for the same request path, reducing resource waste and solving the problem of code redundancy and difficulty in maintenance. The specific solution is as follows:
[0004] Firstly, this application provides a method for initiating a request, including:
[0005] The current request path and current request parameters are obtained through a preset arrow function, and the timer is restarted. The request path and request parameters obtained by the preset arrow function are added to the current task variables.
[0006] If the current countdown of the timer has not reached the preset duration and the preset arrow function obtains the next request path and the next request parameter, then jump back to the step of controlling the timer to restart the countdown until the current countdown of the timer reaches the preset duration, so as to call the request initiation function to jointly initiate the target request based on each request path and each request parameter in the current task variable; wherein, each request path in the current task variable is the same request path.
[0007] Optionally, adding the request path and request parameters obtained by the preset arrow function to the current task variables includes:
[0008] The request path and request parameters obtained by the preset arrow function, as well as the result variable defined by the reactive function for the request parameters, are added to the current task variables; wherein, the reactive function is a function used to create reactive data.
[0009] Optionally, after the function that initiates the request calls jointly initiates the target request based on each request path and each request parameter in the current task variable, it further includes:
[0010] Obtain the request results corresponding to each request parameter in the target request, and assign the request results corresponding to each request parameter in the target request to the corresponding result variables in the current task variables;
[0011] Return the assigned result variable in the current task variable to the initiator of the corresponding request parameter, and clear the current task variable.
[0012] Optionally, the call request initiation function initiates a target request based on each request path and each request parameter in the current task variable, including:
[0013] The request initiation function is called to obtain the request path array and request parameter array from the current task variable, and the request path array and request parameter array are traversed to jointly initiate the target request based on each traversed request path and each request parameter.
[0014] Optionally, the control timer restarts its timing, including:
[0015] Determine if the current count of the timer is zero;
[0016] If the current count of the timer is not zero, the timer clear function is called to clear the timer and control the timer to restart the countdown.
[0017] If the current count of the timer is zero, then the timer is directly controlled to start counting.
[0018] Optionally, the request initiation method further includes:
[0019] After the request initiation function is called to jointly initiate the target request based on each request path and each request parameter in the current task variable, the timer clearing function is called to clear the timer.
[0020] Optionally, adding the request path and request parameters obtained by the preset arrow function to the current task variables includes:
[0021] Create a temporary task variable, and retrieve a value from the current task variable based on the request path obtained by the preset arrow function, and assign the value to the temporary task variable;
[0022] Determine whether the temporary task variable after assignment is empty. If it is, set the temporary task variable after assignment to an empty array and add the request path and request parameters obtained by the preset arrow function to the temporary task variable set to an empty array. If not, add the request path and request parameters obtained by the preset arrow function to the temporary task variable after assignment.
[0023] The temporary task variable is assigned to the current task variable to update the current task variable, and the temporary task variable is deleted.
[0024] Secondly, this application provides a request initiation device, comprising:
[0025] The task acquisition module is used to obtain the current request path and current request parameters through a preset arrow function, control the timer to restart the timing, and add the request path and request parameters obtained by the preset arrow function to the current task variable;
[0026] The request initiation module is used to, if the current countdown of the timer has not reached the preset duration and the preset arrow function obtains the next request path and the next request parameter, then jump back to the step of controlling the timer to restart the countdown until the current countdown of the timer reaches the preset duration, so as to call the request initiation function to jointly initiate the target request based on each request path and each request parameter in the current task variable; wherein, each request path in the current task variable is the same request path.
[0027] Thirdly, this application provides an electronic device, comprising:
[0028] Memory, used to store computer programs;
[0029] A processor for executing the computer program to implement the aforementioned request initiation method.
[0030] Fourthly, this application provides a computer-readable storage medium for storing a computer program, wherein the computer program, when executed by a processor, implements the aforementioned request initiation method.
[0031] In this application, the current request path and current request parameters are obtained through a preset arrow function, and a timer is restarted. The request path and request parameters obtained by the preset arrow function are added to the current task variable. If the current timer countdown has not reached the preset duration and the preset arrow function obtains the next request path and next request parameters, the process jumps back to the step of restarting the timer until the current timer countdown reaches the preset duration. Then, a request initiation function is called to initiate a target request based on the request paths and request parameters in the current task variable. As can be seen, this application continuously obtains the request path and request parameters through arrow functions and restarts the timer each time a request path and request parameters are obtained, while adding the request path and request parameters to the task variable. If the current timer countdown reaches the preset duration, a target request is initiated based on the request paths and request parameters in the task variable. In this way, this application only needs to initiate one request for different request parameters under the same request path, which reduces the waste of request resources compared to initiating one request based on one interface address and one interface parameter. Furthermore, by combining arrow functions, timers, and request initiation functions, this application can initiate one request for different request parameters under the same request path. Compared to adding and maintaining additional parameter statistics code, this reduces code complexity and improves code maintainability. Attached Figure Description
[0032] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0033] Figure 1 This is a flowchart of a request initiation method disclosed in this application;
[0034] Figure 2 This is a flowchart of a specific request initiation method disclosed in this application;
[0035] Figure 3 This is a schematic diagram of a request initiation device disclosed in this application;
[0036] Figure 4 This is a structural diagram of an electronic device disclosed in this application. Detailed Implementation
[0037] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0038] Traditionally, there are two approaches to initiating HTTP requests with the same URL but different parameters in application projects. The first is to directly initiate an HTTP request based on an interface address and its parameters, which easily leads to resource waste. The second is to add extra parameter statistics code to collect the addresses and parameters of various interfaces when entering a page of the project, and then initiate an HTTP request. This not only increases code complexity, but also requires modification of the parameter statistics code when an interface changes, increasing the difficulty of code maintenance. To address this, this application provides a request initiation method that combines arrow functions, timers, and request initiation functions. When faced with the same request path but different request parameters, only one request needs to be initiated, reducing resource waste and solving the problem of code redundancy and difficulty in maintenance.
[0039] See Figure 1 As shown, an embodiment of the present invention discloses a request initiation method, including:
[0040] Step S11: Obtain the current request path and current request parameters through a preset arrow function, control the timer to restart, and add the request path and request parameters obtained by the preset arrow function to the current task variable.
[0041] In this embodiment, the current request path and current request parameters are first obtained through a preset arrow function, and the timer is controlled to start counting from zero. Then, the request path and request parameters obtained by the preset arrow function are added to the current task variable in the format of the current task variable. For example, the format of the current task variable can be an object format; and the request path can be a URL (uniform resource locator).
[0042] Specifically, to control the timer to start counting from zero, it is necessary to first determine whether the current count of the timer is zero. If the current count of the timer is not zero, the timer clear function is called to clear the timer and control the cleared timer to start counting again. If the current count of the timer is zero, the timer is directly controlled to start counting.
[0043] Furthermore, after the preset arrow function obtains the request path and request parameters, it needs to add these, along with the result variable defined for the request parameters by the reactive function, to the current task variables. It's important to note that the result variable is defined for the request parameters using the reactive function, and its value is currently empty. The reactive function is used to create reactive data; that is, the result variable is reactive data. When the result variable changes, the page in the application project will automatically re-render, thus updating the content in the view. The reactive function can be the `ref` function (reference function) provided by Vue 3.
[0044] It should be noted that the current task variable is used to store the task that needs to be executed now, and the current task variable can be in object format; for example, the object format of the current task variable can be: {[request path]:[{request parameters:{}, result variables:{}}]}, where the request parameters and result variables are stored in array format respectively.
[0045] Specifically, to add the request path and request parameters obtained from the preset arrow function to the current task variable, a temporary task variable needs to be created first. The value is then retrieved from the current task variable based on the request path obtained from the preset arrow function (i.e., the request path is used as the key to retrieve the value from the current task variable) and assigned to the temporary task variable. Next, it is checked whether the assigned temporary task variable is empty. If it is, the current task variable is empty, and its format needs to be set, for example, by setting it to an empty array. This step initializes the format of the temporary task variable to add the request path and request parameters obtained from the preset arrow function to the empty array. If the assigned temporary task variable is not empty, the current task variable is not empty, and its format is the same as the current task variable. In this case, the request path and request parameters obtained from the preset arrow function can be directly added to the assigned temporary task variable. After adding the request path and request parameters obtained from the preset arrow function to the temporary task variable, it is necessary to assign the temporary task variable to the current task variable to update the current task variable, and then delete the temporary task variable to save memory and avoid potential variable conflicts.
[0046] More specifically, to add the request path and parameters obtained from the preset arrow function, along with the result variable defined for the request parameters by the reactive function, to the current task variable, a temporary task variable must first be created. The request path obtained from the preset arrow function is used as the key to retrieve a value from the current task variable and assign it to the temporary task variable. Then, it is checked whether the assigned temporary task variable is empty. If it is empty, it is set to an empty array, and the request path, request parameters, and result variable defined for the request parameters by the preset arrow function are added to this empty array. If the assigned temporary task variable is not empty, the request path, request parameters, and result variable defined for the request parameters by the reactive function are directly added to the assigned temporary task variable. Finally, the temporary task variable is assigned to the current task variable to update it, and then the temporary task variable is deleted to save memory and avoid potential variable conflicts.
[0047] Step S12: If the current countdown of the timer has not reached the preset duration and the preset arrow function obtains the next request path and the next request parameter, then jump back to the step of controlling the timer to restart the countdown until the current countdown of the timer reaches the preset duration, so as to call the request initiation function to jointly initiate the target request based on each request path and each request parameter in the current task variable; wherein, each request path in the current task variable is the same request path.
[0048] In this embodiment, the preset arrow function continuously acquires the request path and request parameters, and controls the timer to restart each time a request path and request parameters are acquired. When the current timer countdown has not reached the preset duration, if the preset arrow function acquires a new request path and request parameters, it jumps back to step S11 to control the timer to restart. When the current timer countdown reaches the preset duration, the request initiation function is called to initiate a target request using all request paths and request parameters in the current task variables.
[0049] It should be noted that this application pertains to the same web application project; therefore, all request paths in the current task variable are the same. It should also be noted that the preset duration can be set according to the user's actual request needs, for example, it can be set to 500ms. Furthermore, the requests in this application can be HTTP requests.
[0050] In order to initiate a target request, the request initiation function is first called to obtain the request path array and request parameter array from the current task variables, and then the request path array and request parameter array are traversed to initiate a target request based on each traversed request path and each request parameter.
[0051] Furthermore, after initiating the target request, the system retrieves the request results corresponding to each request parameter in the target request and calls the request initiation function to distribute these results. Specifically, retrieving the request results corresponding to each request parameter in the target request involves assigning the corresponding request results to the corresponding result variables in the current task variables, since each request parameter corresponds to one request result and one result variable. Then, the assigned result variables in the current task variables are distributed to the initiator of the corresponding request parameter so that the initiator can view the request results. Finally, the current task variables need to be cleared to save unnecessary resource consumption.
[0052] It should also be noted that after the request initiation function is called to initiate the target request based on the request paths and request parameters in the current task variables, the timer clearing function needs to be called to clear the timer in order to save unnecessary resource consumption and facilitate the subsequent use of the timer.
[0053] As shown above, this application continuously obtains the request path and request parameters through arrow functions. Each time a request path and parameters are obtained, the timer restarts, and the request path and parameters are added to the task variable. If the timer's current countdown reaches a preset duration, a single target request is initiated based on all request paths and parameters in the task variable. In this way, for different request parameters under the same request path, this application only needs to initiate one request, reducing the waste of request resources compared to initiating a request based on an interface address and interface parameters. Furthermore, by combining arrow functions, timers, and request initiation functions, this application can initiate a single request for different request parameters under the same request path, reducing code complexity and improving code maintainability compared to adding and maintaining additional parameter statistics code.
[0054] See Figure 2 As shown, an embodiment of the present invention discloses a request initiation method, including:
[0055] In the preparation phase, first create a .js file named `useHttp` (a JavaScript file) and import the `ref` reactive function provided by Vue 3 into this file. The `ref` reactive function is used to create reactive data. It's important to note that all functions and variables used subsequently are defined in this .js file. For example, define a timer variable `timer`, initialized to null, to store the timer. Define the current task variable `task`, initialized to `{}`, to store the task to be executed. The object format is: `{[url]:[{params:{},result:{}}]}`, where `url` represents the request path, `params` represents the request parameters, and `result` represents the result variable. That is, the current task variable includes an array of request paths determined by the request path and an array of request parameters determined by the request parameters and result variable. Define a request initiation function `request`, used to initiate an HTTP request based on the received current task variable and to distribute the request result. Define an arrow function named `useHttp` to receive the request path and request parameters, and it is exported by default.
[0056] During the actual request initiation phase, the current request path and current request parameters are first obtained through an arrow function, and it is determined whether the timer value is zero. If the timer value is not zero, the timer clear function clearTimeout(timer) is called to clear the timer so that the timer will restart when the request path and request parameters are obtained by the arrow function. If the timer value is zero, the timer is directly controlled to start counting.
[0057] Furthermore, a temporary task variable `temp` is defined, and the request path obtained from the arrow function is used as the key to retrieve a value from the current task variable `task`, which is then assigned to the temporary task variable. It is then checked whether the assigned temporary task variable is empty, i.e., whether a task exists in `task`. If the assigned temporary task variable is empty, meaning no task exists, it is set to an empty array, and the request path, request parameters obtained from the arrow function, and the result variable `result` defined for the request parameters in the reactive function are added to the empty array of the temporary task variable. If the assigned temporary task variable is not empty, meaning a task exists, the request path, request parameters obtained from the arrow function, and the result variable `result` defined for the request parameters in the reactive function are directly added to the assigned temporary task variable. Finally, the temporary task variable is assigned to the current task variable to update the current task variable, and then the temporary task variable is deleted.
[0058] If the arrow function obtains a new request path and request parameters before the timer reaches 500ms, it will jump back to the step of checking if the timer value is zero. When the timer reaches 500ms, the request initiation function is called to initiate an HTTP request using all request paths and parameters in the current task variable. The function then retrieves the request results corresponding to each request parameter in the HTTP request, assigns each result to its corresponding result variable in the current task variable, and distributes the assigned result variables to the initiator of the corresponding request parameter so that the initiator can view the request results. Finally, the current task variable is reset and cleared.
[0059] As shown above, this application continuously obtains the request path and request parameters through arrow functions. Each time a request path and parameters are obtained, the timer restarts, and the request path and parameters are added to the task variable. If the timer's current countdown reaches a preset duration, a single target request is initiated based on all request paths and parameters in the task variable. In this way, for different request parameters under the same request path, this application only needs to initiate one request, reducing the waste of request resources compared to initiating a request based on an interface address and interface parameters. Furthermore, by combining arrow functions, timers, and request initiation functions, this application can initiate a single request for different request parameters under the same request path, reducing code complexity and improving code maintainability compared to adding and maintaining additional parameter statistics code.
[0060] See Figure 3 As shown in the embodiments of this application, a request initiation device is also disclosed, comprising:
[0061] The task acquisition module 11 is used to acquire the current request path and current request parameters through a preset arrow function, control the timer to restart the timing, and add the request path and request parameters acquired by the preset arrow function to the current task variable;
[0062] The request initiation module 12 is used to, if the current countdown of the timer has not reached the preset duration and the preset arrow function obtains the next request path and the next request parameter, then jump back to the step of controlling the timer to restart the countdown until the current countdown of the timer reaches the preset duration, so as to call the request initiation function to jointly initiate the target request based on each request path and each request parameter in the current task variable; wherein, each request path in the current task variable is the same request path.
[0063] As shown above, this application utilizes arrow functions to continuously capture request paths and request parameters, and restarts the timer each time a request path and parameters are captured, while simultaneously adding the captured request path and parameters to the task variable. If the timer's current countdown reaches the preset duration, a target request is initiated based on each request path and each request parameter in the task variable. In this approach, for the same request path but different request parameters, only one request needs to be initiated, reducing the waste of request resources compared to initiating a request based on each interface address and parameter. Furthermore, the coordinated use of arrow functions, timers, and request initiation functions avoids the need for additional parameter statistics code, thereby reducing code complexity and improving code maintainability.
[0064] In some specific embodiments, the task acquisition module 11 may specifically include:
[0065] The addition unit is used to add the request path and request parameters obtained by the preset arrow function and the result variable defined by the reactive function for the request parameters to the current task variables; wherein, the reactive function is a function used to create reactive data.
[0066] In some specific embodiments, the request initiating device may further include:
[0067] The request result assignment module is used to obtain the request result corresponding to each request parameter in the target request, and assign the request result corresponding to each request parameter in the target request to the corresponding result variable in the current task variable;
[0068] The task variable clearing module is used to return the assigned result variable in the current task variable to the initiator of the corresponding request parameter and clear the current task variable.
[0069] In some specific embodiments, the request initiation module 12 may specifically include:
[0070] The request initiation unit is used to call the request initiation function to obtain the request path array and the request parameter array from the current task variable, and to traverse the request path array and the request parameter array to jointly initiate a target request based on each traversed request path and each request parameter.
[0071] In some specific embodiments, the task acquisition module 11 may specifically include:
[0072] The timer timing unit is used to determine whether the current timer count is zero. If the current timer count is not zero, the timer clear function is called to clear the timer and the timer is restarted. If the current timer count is zero, the timer is directly started.
[0073] In some specific embodiments, the request initiating device may further include:
[0074] The timer clearing unit is used to clear the timer after the request initiation function is called to jointly initiate the target request based on the request paths and request parameters in the current task variables.
[0075] In some specific embodiments, the task acquisition module 11 may specifically include:
[0076] The variable creation unit is used to create temporary task variables and retrieve values from the current task variables based on the request path obtained by the preset arrow function, and assign the values to the temporary task variables.
[0077] The variable assignment unit is used to determine whether the temporary task variable after assignment is empty. If it is, the temporary task variable after assignment is set to an empty array, and the request path and request parameters obtained by the preset arrow function are added to the temporary task variable set to an empty array. If not, the request path and request parameters obtained by the preset arrow function are added to the temporary task variable after assignment.
[0078] The variable update unit is used to assign the temporary task variable to the current task variable to update the current task variable, and delete the temporary task variable.
[0079] Furthermore, embodiments of this application also disclose an electronic device, Figure 4 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content of the diagram should not be construed as limiting the scope of this application.
[0080] Figure 4 This is a schematic diagram of the structure of an electronic device 20 provided in an embodiment of this application. Specifically, the electronic device 20 may include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 stores a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the request initiation method disclosed in any of the foregoing embodiments. Furthermore, the electronic device 20 in this embodiment may specifically be an electronic computer.
[0081] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol it follows can be any communication protocol applicable to the technical solution of this application, and is not specifically limited here; the input / output interface 25 is used to acquire external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.
[0082] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or optical disk, etc. The resources stored thereon can include operating system 221, computer program 222, etc., and the storage method can be temporary storage or permanent storage.
[0083] The operating system 221 is used to manage and control the various hardware devices on the electronic device 20 and the computer program 222, which may be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program capable of performing the request initiation method executed by the electronic device 20 as disclosed in any of the foregoing embodiments, the computer program 222 may further include a computer program capable of performing other specific tasks.
[0084] Furthermore, this application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, it implements the aforementioned request initiation method. Specific steps of this method can be found in the corresponding content disclosed in the foregoing embodiments, and will not be repeated here.
[0085] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.
[0086] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0087] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.
[0088] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0089] The technical solutions provided in this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A request initiation method, characterized in that, include: The current request path and current request parameters are obtained through a preset arrow function, and the timer is restarted. The request path and request parameters obtained by the preset arrow function are added to the current task variables. If the current countdown of the timer has not reached the preset duration and the preset arrow function obtains the next request path and the next request parameter, then jump back to the step of controlling the timer to restart the countdown until the current countdown of the timer reaches the preset duration, so as to call the request initiation function to jointly initiate the target request based on each request path and each request parameter in the current task variable; wherein, each request path in the current task variable is the same request path.
2. The request initiation method according to claim 1, characterized in that, The step of adding the request path and request parameters obtained by the preset arrow function to the current task variables includes: The request path and request parameters obtained by the preset arrow function, as well as the result variable defined by the reactive function for the request parameters, are added to the current task variables; wherein, the reactive function is a function used to create reactive data.
3. The request initiation method according to claim 2, characterized in that, After the request initiation function initiates the target request based on the request paths and request parameters in the current task variables, it also includes: Obtain the request results corresponding to each request parameter in the target request, and assign the request results corresponding to each request parameter in the target request to the corresponding result variables in the current task variables; Return the assigned result variable in the current task variable to the initiator of the corresponding request parameter, and clear the current task variable.
4. The request initiation method according to claim 1, characterized in that, The function that initiates the request calls initiates a target request based on the request paths and request parameters in the current task variables, including: The request initiation function is called to obtain the request path array and request parameter array from the current task variable, and the request path array and request parameter array are traversed to jointly initiate the target request based on each traversed request path and each request parameter.
5. The request initiation method according to claim 1, characterized in that, The control timer restarts counting, including: Determine if the current count of the timer is zero; If the current count of the timer is not zero, the timer clear function is called to clear the timer and control the timer to restart the countdown. If the current count of the timer is zero, then the timer is directly controlled to start counting.
6. The request initiation method according to claim 5, characterized in that, Also includes: After the request initiation function is called to jointly initiate the target request based on each request path and each request parameter in the current task variable, the timer clearing function is called to clear the timer.
7. The request initiation method according to any one of claims 1 to 6, characterized in that, The step of adding the request path and request parameters obtained by the preset arrow function to the current task variables includes: Create a temporary task variable, and retrieve a value from the current task variable based on the request path obtained by the preset arrow function, and assign the value to the temporary task variable; Determine whether the temporary task variable after assignment is empty. If it is, set the temporary task variable after assignment to an empty array and add the request path and request parameters obtained by the preset arrow function to the temporary task variable set to an empty array. If not, add the request path and request parameters obtained by the preset arrow function to the temporary task variable after assignment. The temporary task variable is assigned to the current task variable to update the current task variable, and the temporary task variable is deleted.
8. A request initiation device, characterized in that, include: The task acquisition module is used to obtain the current request path and current request parameters through a preset arrow function, control the timer to restart the timing, and add the request path and request parameters obtained by the preset arrow function to the current task variable; The request initiation module is used to, if the current countdown of the timer has not reached the preset duration and the preset arrow function obtains the next request path and the next request parameter, then jump back to the step of controlling the timer to restart the countdown until the current countdown of the timer reaches the preset duration, so as to call the request initiation function to jointly initiate the target request based on each request path and each request parameter in the current task variable; wherein, each request path in the current task variable is the same request path.
9. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the request initiation method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, Used to store a computer program, which, when executed by a processor, implements the request initiation method as described in any one of claims 1 to 7.