Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
shoonia committed Apr 18, 2021
1 parent 686ea3a commit c503aca
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
32 changes: 24 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
# repeater-scope

Create handlers for the repeater items.
The utils for Repeater scope event handlers in Velo by Wix.

## useScope

**`Page Code`**

```js
import { createScope } from 'public/util';

// Create a scope with a callback function that returns actual repeater data.
const useScope = createScope(() => {
return $w('#repeater').data;
});
import { useScope } from 'repeater-scope';

$w.onReady(() => {
// use a dynamic event handler
Expand All @@ -25,6 +22,25 @@ export function repeatedButton_dblClick(event) {
}
```

## createScope

**`Page Code`**

```js
import { createScope } from 'repeater-scope';

// Create a scope with a callback function that returns actual repeater data.
const useScope = createScope(() => {
return $w('#repeater').data;
});

export function repeatedButton_dblClick(event) {
const { $item, itemData, index, data } = useScope(event);
}
```

- [Velo by Wix: Event handling of Repeater Item](https://shoonia.site/event-handling-of-repeater-item/)

## MIT
## License

[MIT](./LICENSE)
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "repeater-scope",
"version": "1.0.0",
"description": "Create handlers for the repeater items",
"description": "The utils for Repeater scope event handlers in Velo by Wix.",
"main": "src/index.js",
"scripts": {},
"sideEffects": false,
Expand Down

0 comments on commit c503aca

Please sign in to comment.