Skip to content

Commit 62cb2c8

Browse files
committed
update docs
1 parent 3903bdd commit 62cb2c8

1 file changed

Lines changed: 9 additions & 10 deletions

File tree

packages/shadow-objects/README.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,28 +46,27 @@ import { ShadowObjectCreationAPI } from "@spearwolf/shadow-objects";
4646

4747
export function MyShadowObject({
4848
useProperty,
49-
useContext,
5049
createEffect,
51-
on,
5250
onDestroy
5351
}: ShadowObjectCreationAPI) {
5452

55-
// 1. Read Properties
53+
// Read Properties
5654
const title = useProperty("title");
5755

58-
// 2. React to changes
56+
// React to changes
5957
createEffect(() => {
6058
console.log("Title is now:", title());
6159
});
6260

63-
// 3. Handle Lifecycle
61+
// Handle Lifecycle
6462
onDestroy(() => {
6563
console.log("Shadow Object destroyed");
6664
});
6765

68-
// 4. Return public methods (optional)
66+
// Return public methods (optional)
67+
// These can be called by events (more on that later)
6968
return {
70-
someMethod() { /* ... */ }
69+
doSomething() { /* ... */ }
7170
};
7271
}
7372
```
@@ -144,12 +143,12 @@ In your HTML or View layer, you use the provided Web Components to create the En
144143
<shae-worker-env src="./my-module.js"></shae-worker-env>
145144

146145
<!-- 2. Create Entities -->
147-
<shae-ent token="my-component">
146+
<shae-ent token="my-entity">
148147
<!-- Properties -->
149148
<shae-prop name="title" value="Hello World"></shae-prop>
150149

151150
<!-- Nested Entities -->
152-
<shae-ent token="child-component"></shae-ent>
151+
<shae-ent token="child-entity"></shae-ent>
153152
</shae-ent>
154153
```
155154

@@ -159,7 +158,7 @@ In your HTML or View layer, you use the provided Web Components to create the En
159158

160159
### Lifecycle
161160

162-
1. **Creation**: When an Entity is created (e.g., `<shae-ent>` connects), the Kernel looks up its Token in the Registry.
161+
1. **Creation**: When an Entity is created (e.g., `<shae-ent>` connects to the document), the Kernel looks up its Token in the Registry.
163162
2. **Instantiation**: The Kernel instantiates all Shadow Objects associated with that Token (and its routes).
164163
3. **Execution**: The Shadow Object function runs, setting up signals, effects, and context providers.
165164
4. **Updates**:

0 commit comments

Comments
 (0)