Return true if jspi can be used. This requires both browser support and also WebAssembly to be in the correct state - i.e. that the javascript call into python was async not sync. :return: True if jspi can be used. :rtype: bool
()
| 678 | |
| 679 | |
| 680 | def has_jspi() -> bool: |
| 681 | """ |
| 682 | Return true if jspi can be used. |
| 683 | |
| 684 | This requires both browser support and also WebAssembly |
| 685 | to be in the correct state - i.e. that the javascript |
| 686 | call into python was async not sync. |
| 687 | |
| 688 | :return: True if jspi can be used. |
| 689 | :rtype: bool |
| 690 | """ |
| 691 | try: |
| 692 | from pyodide.ffi import can_run_sync, run_sync # noqa: F401 |
| 693 | |
| 694 | return bool(can_run_sync()) |
| 695 | except ImportError: |
| 696 | return False |
| 697 | |
| 698 | |
| 699 | def _is_node_js() -> bool: |
no outgoing calls