Skip to content

Commit

Permalink
docs update
Browse files Browse the repository at this point in the history
  • Loading branch information
infinite-system committed Aug 12, 2024
1 parent d65346c commit 70466ad
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions docs/docs/pages/how-it-works.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,18 @@ To understand how ivue works, it is important to understand, how it does not wor

### `ivue` has a simple approach:

—  `ivue` mimicks native JavaScript / TypeScript class implementation by extending descriptors (getters and setters) up the whole prototype chain thus supporting classical inheritance.
—  `ivue` replicates native JavaScript / TypeScript class implementation by extending descriptors (getters and setters) up the whole prototype chain thus supporting classical inheritance.

—  By using TypeScript we are able to infer the arguments of the main `ivue` initializer function and pass the arguments to the constructor.

—  `ivue` initializer function returns an extended Vue 3 `reactive()` object with getters internally converted to computeds and adds `.toRefs()` method to the object. Computeds auto-unwrap themselves when they are accessed as a reactive object, so the `.value` gets flattened into the final object.
—  `ivue` initializer function returns an extended Vue 3 `reactive()` object with getters internally converted to computeds and adds `.toRefs()` method to the created object. Computeds auto-unwrap themselves when they are accessed as a reactive object, so the `.value` properties and computeds get flattened in the resulting object and do not require `.value` to be accessed.

&mdash; &nbsp;`ivue` recommends all props to be defined as `ref()` to be able to interoperate with `defineExpose()`, if you simply pass reactive props which are not Refs through `defineExpose()`, they will lose reactivity. `ref()` refs like computed refs get flattened into the `reactive()` object, so there is no need to worry about using `.value` here either. The `ref()` refs are necessary just internally for Vue 3 to know which refs to keep reactive, and we just convert the types back to their normal types as if they have no reactivity at all, so `Ref<number>` is `number` in `ivue`, so rather than going in the direction of complexifying the types, we are going inte opposite direction of simplification.
&mdash; &nbsp;`ivue` recommends all props to be defined as `ref()` to be able to interoperate with `defineExpose()`, if you simply pass reactive props which are not Refs through `defineExpose()`, they will lose reactivity. `ref()` refs just like computed refs get flattened into the `reactive()` object, so there is no need to worry about using `.value` here either. The `ref()` refs are necessary just internally for Vue 3 to know which refs to keep reactive, and we just convert the types back to their normal types as if they have no reactivity at all, so `Ref<number>` is `number` in `ivue`, so rather than going in the direction of complexifying the types, we are going inte opposite direction of simplification.

&mdash; &nbsp;`.toRefs()` allows the object to be converted to native composable structure with full `.value`, so it can interoperate as a composable if needed.

&mdash; &nbsp;`ivue` aims to be opaque and minimal, just doing the minimum to convert a class to a reactive object, leaving the rest to be implemented using Vue 3 Composition API inside an initializer function called `.init()`


### Classic Counter example built with `ivue`
<<< @/components/examples/CounterBasic.vue

Expand Down

0 comments on commit 70466ad

Please sign in to comment.