Skip to content

Commit

Permalink
doc: regenerate doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Jack-Works committed Oct 11, 2019
1 parent a205b5a commit 8692c83
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 65 deletions.
18 changes: 9 additions & 9 deletions api-documents/kit.eventwatcher.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ A Watcher based on event handlers.
export declare class EventWatcher<T, Before extends Element = HTMLSpanElement, After extends Element = HTMLSpanElement, SingleMode extends boolean = false> extends Watcher<T, Before, After, SingleMode>
```
## Example
```ts
const e = new EventWatcher(ls).useForeach(node => console.log(node))
document.addEventListener('event', e.eventListener)

```
## Constructors
| Constructor | Modifiers | Description |
Expand All @@ -25,12 +34,3 @@ export declare class EventWatcher<T, Before extends Element = HTMLSpanElement, A
| [enableSingleMode](./kit.eventwatcher.enablesinglemode.md) | | <code>() =&gt; EventWatcher&lt;T, Before, After, true&gt;</code> | Enable single mode. |
| [eventListener](./kit.eventwatcher.eventlistener.md) | | <code>() =&gt; void</code> | Use this function as event listener to invoke watcher. |
## Example
```ts
const e = new EventWatcher(ls).useForeach(node => console.log(node))
document.addEventListener('event', e.eventListener)

```
24 changes: 12 additions & 12 deletions api-documents/kit.intervalwatcher.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@ A watcher based on time interval.
export declare class IntervalWatcher<T, Before extends Element = HTMLSpanElement, After extends Element = HTMLSpanElement, SingleMode extends boolean = false> extends Watcher<T, Before, After, SingleMode>
```
## Example
```ts
new IntervalWatcher(ls)
.useForeach(node => {
console.log(node)
})
.startWatch(1000)

```
## Properties
| Property | Modifiers | Type | Description |
Expand All @@ -25,15 +37,3 @@ export declare class IntervalWatcher<T, Before extends Element = HTMLSpanElement
| [startWatch(interval)](./kit.intervalwatcher.startwatch.md) | | Start to watch the LiveSelector at a interval(ms). |
| [stopWatch()](./kit.intervalwatcher.stopwatch.md) | | Stop the watcher |
## Example
```ts
new IntervalWatcher(ls)
.useForeach(node => {
console.log(node)
})
.startWatch(1000)

```
26 changes: 13 additions & 13 deletions api-documents/kit.liveselector.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,19 @@ Create a live selector that can continuously select the element you want.
export declare class LiveSelector<T, SingleMode extends boolean = false>
```

## Remarks

Call [\#evaluate](./kit.liveselector.evaluate.md) to evaluate the element. Falsy value will be ignored.

## Example


```ts
const ls = new LiveSelector().querySelectorAll('a').map(x => x.href)
ls.evaluate() // returns all urls at the current time.

```

## Constructors

| Constructor | Modifiers | Description |
Expand Down Expand Up @@ -51,16 +64,3 @@ export declare class LiveSelector<T, SingleMode extends boolean = false>
| [slice(start, end)](./kit.liveselector.slice.md) | | Returns a section of an array. |
| [sort(compareFn)](./kit.liveselector.sort.md) | | Sorts an array. |

## Remarks

Call [\#evaluate](./kit.liveselector.evaluate.md) to evaluate the element. Falsy value will be ignored.

## Example


```ts
const ls = new LiveSelector().querySelectorAll('a').map(x => x.href)
ls.evaluate() // returns all urls at the current time.

```

26 changes: 13 additions & 13 deletions api-documents/kit.mutationobserverwatcher.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@ A watcher based on MutationObserver
export declare class MutationObserverWatcher<T, Before extends Element = HTMLSpanElement, After extends Element = HTMLSpanElement, SingleMode extends boolean = false> extends Watcher<T, Before, After, SingleMode>
```
## Example
```ts
new MutationObserverWatcher(ls)
.useForeach(node => {
console.log(node)
})
.startWatch()

```
## Constructors
| Constructor | Modifiers | Description |
Expand All @@ -29,18 +41,6 @@ export declare class MutationObserverWatcher<T, Before extends Element = HTMLSpa
| Method | Modifiers | Description |
| --- | --- | --- |
| [startWatch(options)](./kit.mutationobserverwatcher.startwatch.md) | | Start an MutationObserverWatcher.<!-- -->You must provide a reasonable MutationObserverInit to reduce dom events.<!-- -->https://mdn.io/MutationObserverInit |
| [startWatch(options)](./kit.mutationobserverwatcher.startwatch.md) | | Start an MutationObserverWatcher. |
| [stopWatch()](./kit.mutationobserverwatcher.stopwatch.md) | | Stop the watcher |
## Example
```ts
new MutationObserverWatcher(ls)
.useForeach(node => {
console.log(node)
})
.startWatch()

```
10 changes: 6 additions & 4 deletions api-documents/kit.mutationobserverwatcher.startwatch.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@

Start an MutationObserverWatcher.

You must provide a reasonable MutationObserverInit to reduce dom events.

https://mdn.io/MutationObserverInit

<b>Signature:</b>

```typescript
Expand All @@ -26,3 +22,9 @@ startWatch(options: MutationObserverInit): this;

`this`

## Remarks

You must provide a reasonable MutationObserverInit to reduce dom events.

https://mdn.io/MutationObserverInit

28 changes: 14 additions & 14 deletions api-documents/kit.valueref.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,20 @@ A `ref` object with `addListener`
export declare class ValueRef<T>
```

## Example


```ts
const ref = new ValueRef(64)
function useRef() {
const [state, setState] = React.useState(ref.value)
React.useEffect(() => ref.addListener(e => setState(e)))
return state
}
ref.value = 42 // useRef will receive the new value

```

## Constructors

| Constructor | Modifiers | Description |
Expand All @@ -32,17 +46,3 @@ export declare class ValueRef<T>
| [removeAllListener()](./kit.valueref.removealllistener.md) | | Remove all listeners |
| [removeListener(fn)](./kit.valueref.removelistener.md) | | Remove a listener |

## Example


```ts
const ref = new ValueRef(64)
function useRef() {
const [state, setState] = React.useState(ref.value)
React.useEffect(() => ref.addListener(e => setState(e)))
return state
}
ref.value = 42 // useRef will receive the new value

```

0 comments on commit 8692c83

Please sign in to comment.