Skip to content

Commit d21ab2f

Browse files
authored
Update README.md to emphasize that CustomJS only supports single class definitions per file. Added examples of incorrect and correct usage to clarify the requirements for file structure. (#104)
1 parent 316fa42 commit d21ab2f

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,18 @@ Allows you to bind an [Invocable Script](#invocable-scripts) to a hotkey.
4141
4242
## Usage/Example
4343

44-
CustomJS works by writing javascript classes. Each file can contain one class _and only one class_. Imports, constants, etc defined outside the class will break CustomJS.
44+
**Important:** CustomJS **only** works with JavaScript classes. Each file must contain exactly one class - no more, no less. Any other code structure will not work.
45+
46+
**This will NOT work:**
47+
- `module.exports = Highlights;`
48+
- Bare functions like `function myFunction() {}`
49+
- Variable exports like `export const myVar = "value";`
50+
- Any code outside of a class definition
51+
52+
**Only this works:**
53+
- A single class definition per file, like `class MyClass { ... }`
54+
55+
Imports, constants, and any other code defined outside the class will break CustomJS. Everything must be contained within the class definition.
4556

4657
### Accessing your classes
4758

0 commit comments

Comments
 (0)