js - check if a function is completed

Lewis

I want to set a hotkey to several functions by jquery hotkeys. And I need to check if a function is finished, may be something like:

if("function A is completed")
{
    "Ctrl+A is now set to function B"
}
else
{
    "Ctrl+A is set to function A"
}

How could I check this? Or any better ideas?

T.J. Crowder

JavaScript on web browsers is single-threaded (barring the use of web workers, and even with those a function can't be interrupted), so except for a couple of bugs in issues with Firefox, a function cannot be interrupted in the middle. So if your code is running, the other function is not, by definition.

(For details on the issues with Firefox, see this answer by bobince about some very edge-case scenarios.)

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

Check if a script completed executing instead of exiting

분류에서Dev

What's is going wrong with this "Check for Palindromes" JS Function?

분류에서Dev

Execution of JS command on load completed of external widget

분류에서Dev

How to check if a background job completed but keep the Windows form responsive in PowerShell

분류에서Dev

Preventing 'process completed' after bashrc function in OS X

분류에서Dev

Reactively counting the number of form inputs completed in Meteor.js

분류에서Dev

Function Based Check Constraint

분류에서Dev

Function Based Check Constraint

분류에서Dev

Check template class for existence of function

분류에서Dev

How to check if a function is anonymous in R

분류에서Dev

Percentage validation check function in javascript

분류에서Dev

Function to check for first blank cell

분류에서Dev

How can I execute a function right after an "await" request has been completed?

분류에서Dev

Temporarily Override Function JS

분류에서Dev

Temporarily Override Function JS

분류에서Dev

Check for a product category in a hooked function for WooCommerce products

분류에서Dev

How to check a condition after each line of a function?

분류에서Dev

How to check if function was not called in shell script

분류에서Dev

Check for editable column in a table with jQuery function

분류에서Dev

Hiding fields and removing them from a check function

분류에서Dev

how to check an inline function was automatically converted to a regular function by the compiler?

분류에서Dev

Js check if the location is in my site with cross domain

분류에서Dev

How to check if checkbox is checked in Angular JS?

분류에서Dev

function inside for loop (js/jquery)

분류에서Dev

Converting JS Sorting Function To PHP

분류에서Dev

JS Is it possible to access function variable?

분류에서Dev

Recursive function with timeout and check RxJs Observable value polling

분류에서Dev

Using c++ 20 Concept to check if a function returns a const value

분류에서Dev

C++ check from where specified function/method was called

Related 관련 기사

  1. 1

    Check if a script completed executing instead of exiting

  2. 2

    What's is going wrong with this "Check for Palindromes" JS Function?

  3. 3

    Execution of JS command on load completed of external widget

  4. 4

    How to check if a background job completed but keep the Windows form responsive in PowerShell

  5. 5

    Preventing 'process completed' after bashrc function in OS X

  6. 6

    Reactively counting the number of form inputs completed in Meteor.js

  7. 7

    Function Based Check Constraint

  8. 8

    Function Based Check Constraint

  9. 9

    Check template class for existence of function

  10. 10

    How to check if a function is anonymous in R

  11. 11

    Percentage validation check function in javascript

  12. 12

    Function to check for first blank cell

  13. 13

    How can I execute a function right after an "await" request has been completed?

  14. 14

    Temporarily Override Function JS

  15. 15

    Temporarily Override Function JS

  16. 16

    Check for a product category in a hooked function for WooCommerce products

  17. 17

    How to check a condition after each line of a function?

  18. 18

    How to check if function was not called in shell script

  19. 19

    Check for editable column in a table with jQuery function

  20. 20

    Hiding fields and removing them from a check function

  21. 21

    how to check an inline function was automatically converted to a regular function by the compiler?

  22. 22

    Js check if the location is in my site with cross domain

  23. 23

    How to check if checkbox is checked in Angular JS?

  24. 24

    function inside for loop (js/jquery)

  25. 25

    Converting JS Sorting Function To PHP

  26. 26

    JS Is it possible to access function variable?

  27. 27

    Recursive function with timeout and check RxJs Observable value polling

  28. 28

    Using c++ 20 Concept to check if a function returns a const value

  29. 29

    C++ check from where specified function/method was called

뜨겁다태그

보관