Metadata-Version: 2.1
Name: esx
Version: 0.0.2
Summary: A port of Javascript API to python. Useful for interoperability, porting js code and more...
Home-page: https://github.com/byteface/esx
Author: @byteface
Author-email: byteface@gmail.com
License: MIT
Download-URL: https://github.com/byteface/esx/archive/0.0.2 .tar.gz
Keywords: Javascript,JavaScript,js,html,json,web,javascript,es6,es7,es8,es9
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: JavaScript
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Other Audience
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Topic :: Internet
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Multimedia :: Graphics :: Presentation
Classifier: Topic :: Software Development
Classifier: Topic :: Software Development :: Code Generators
Classifier: Topic :: Terminals
Classifier: Topic :: Utilities
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Text Processing :: Markup :: HTML
Requires-Python: >=3.6
Description-Content-Type: text/markdown
Requires-Dist: requests
Requires-Dist: python-dateutil
Requires-Dist: urllib3

<h1 align="center">
    esx
    <br>
    <sup><sub><sup>JS API in python 3!</sup></sub></sup>
    <br>
</h1>

[![PyPI version](https://badge.fury.io/py/esx.svg)](https://badge.fury.io/py/esx.svg) 
[![Downloads](https://pepy.tech/badge/esx)](https://pepy.tech/project/esx)
[![Python version](https://img.shields.io/pypi/pyversions/esx.svg?style=flat)](https://img.shields.io/pypi/pyversions/esx.svg?style=flat)
[![Build status](https://travis-ci.com/byteface/esx.svg?branch=master)](https://travis-ci.com/byteface/esx.svg?branch=master)
[![Python package](https://github.com/byteface/esx/actions/workflows/python-package.yml/badge.svg?branch=master)](https://github.com/byteface/esx/actions/workflows/python-package.yml)


#### Contains

• [esx](https://esx.readthedocs.io/_modules/esx/esx.html) : js API in python 3 😳


#### API


```python
from esx import Math
print(Math.random())

from esx import Array
myArr=Array(1,2,3)
print(myArr.splice(1))

from esx import URL
url = URL('https://somesite.com/blog/article-one#some-hash')
print(url.protocol)
print(url.host)
print(url.pathname)
print(url.hash)

# you can use Global class to import all the js methods from the global namespace i.e
# from esx.esx import Global
# Global.decodeURIComponent(...
# Global.encodeComponent(...
# Global.setInterval(...

# from esx.esx import Date, String, Number
# etc..
```

You can use setInterval and clearInterval with params

```python

from esx import setInterval, clearInterval

x=0

def hi(inc):
    global x
    x = x+inc
    print(x)

test = setInterval(hi, 1000, 2)
import time
time.sleep(5)
clearInterval(test)
print(f"Final value of x:{x}")

```

Or for a single delayed function call use setTimeout, clearTimeout

```python

from esx import setTimeout, clearTimeout

timeoutID = setTimeout(hi, 1000)

```

## DOCS

https://esx.readthedocs.io/

### notes

Do some notes here


### Join-In
Feel free to contribute if you find it useful.

Email me, message me directly if you like or create a discussion on here.

If there are any methods you want that are missing or not complete yet or you think you can help make it better just update the code and send a pull request.

I'll merge and releaese asap.


### run tests

There are tests used during dev. They are useful as code examples and to see what still needs doing.

See Makefile to run all tests:

```bash
make test
```

or to test a single function:
```bash
python -m unittest tests.test_esx.TestCase.test_esx_array
```

or to test a whole module
```bash
python -m unittest tests.test_esx
```

to see coverage
```bash
coverage run -m unittest discover tests/
coverage report
```


