Skip to content

Commit 7556b82

Browse files
committed
refactor!: explicitly rename __tla to ready
1 parent 7b3a105 commit 7556b82

4 files changed

Lines changed: 12 additions & 4 deletions

File tree

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ npm i wikistxr
2424

2525
## Usage
2626

27+
Await `ready` before constructing classes.
28+
2729
### WikitextHighlighter
2830

2931
**Static, full-pass syntax highlighting**
@@ -32,7 +34,9 @@ npm i wikistxr
3234
- Renders to HTML strings.
3335

3436
```javascript
35-
import { WikitextHighlighter } from "wikistxr";
37+
import { ready, WikitextHighlighter } from "wikistxr";
38+
39+
await ready;
3640

3741
const highlighter = new WikitextHighlighter();
3842
const html = highlighter.highlight(wikitextString);
@@ -46,7 +50,9 @@ const html = highlighter.highlight(wikitextString);
4650
- Handles cursor persistence and DOM synchronization.
4751

4852
```javascript
49-
import { WikitextEditor } from "wikistxr";
53+
import { ready, WikitextEditor } from "wikistxr";
54+
55+
await ready;
5056

5157
const editor = new WikitextEditor();
5258
editor.attach(editableDiv);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "wikistxr",
3-
"version": "0.1.4",
3+
"version": "0.1.5",
44
"description": "Lightweight wikitext library for syntax highlighting and editing.",
55
"type": "module",
66
"main": "./dist/index.js",

src/lib/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import {
1212
DEFAULT_STYLES,
1313
} from "./constants";
1414

15+
export declare const ready: Promise<void>;
16+
1517
export {
1618
WikitextHighlighter,
1719
WikitextEditor,

vite.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { resolve } from "path";
33
import topLevelAwait from "vite-plugin-top-level-await";
44

55
export default defineConfig({
6-
plugins: [topLevelAwait()],
6+
plugins: [topLevelAwait({ promiseExportName: "ready" })],
77
build: {
88
lib: {
99
entry: resolve(__dirname, "src/lib/index.ts"),

0 commit comments

Comments
 (0)