|
1 | 1 | # JS ❤️ PY
|
2 | 2 |
|
| 3 | +## JavaScript and Python Coupling |
| 4 | + |
3 | 5 | > JS Loves Py is a set of scripts that will allow you to easily pass data back and forth between JavaScript and Python using Json. This demonstrates one way you can couple langauges together to work with one another. The ability to pass data back and forth between two languages like Python and JavaScript opens doors to a universe of new possibilities.
|
4 | 6 |
|
5 | 7 | ## [Table Of Contents](#table-of-contents)
|
@@ -59,15 +61,15 @@ Both the `JS` and the `Py` classes have the exact same functionality and contain
|
59 | 61 |
|
60 | 62 | ### [JS Class Methods](#js-class-methods)
|
61 | 63 | - `JS.NOTE` - This is where the retieved data from Py is stored
|
62 |
| -- `JS.PATH` - This will store the path passed to checkForNote() |
| 64 | +- `JS.JSON_PATH` - This will store the path passed to checkForNote() |
63 | 65 | - `JS.sendNoteToPy(note_object, path)`
|
64 | 66 | - `JS.getNoteFromPy(path)`
|
65 | 67 | - `JS.checkForNote(path)`
|
66 | 68 |
|
67 | 69 |
|
68 | 70 | ### [Py Class Methods](#py-class-methods)
|
69 | 71 | - `Py.NOTE` - This is where the retieved data from JS is stored
|
70 |
| -- `Py.PATH` - This will store the path passed to check_for_note() |
| 72 | +- `Py.JSON_PATH` - This will store the path passed to check_for_note() |
71 | 73 | - `Py.send_note_to_js(self, note_object: dict, path: str)`
|
72 | 74 | - `Py.get_note_from_js(self, path: str)`
|
73 | 75 | - `Py.check_for_note(self, path: str, file: str)`
|
@@ -117,6 +119,7 @@ py.send_note_to_js({
|
117 | 119 | "title": "Note to JS from Py",
|
118 | 120 | "text": "Hello JavaScript!"
|
119 | 121 | })
|
| 122 | +``` |
120 | 123 |
|
121 | 124 | Once the `send_note_to_js()` method is called the object you passed in will be stored in the ***from_py.json*** file at the specified path and this will automatically be picked up on the JavaScript side by the running `JS.checkForNote()` method from step 1. The data will be stored in the `js.NOTE` property and accessible from there.
|
122 | 125 |
|
|
0 commit comments