Skip to content

Commit

Permalink
feat(bind): bind to path
Browse files Browse the repository at this point in the history
allows you to bind to deep into the context graph, also getValue, setValue helpers added
  • Loading branch information
MrAntix committed Dec 4, 2019
1 parent c81dbdd commit 97754e7
Show file tree
Hide file tree
Showing 34 changed files with 16,364 additions and 5,351 deletions.
14 changes: 7 additions & 7 deletions docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ A small dom binder
## example

<pre style="display:flex">
<button bind [inner-text]="text" {click}="onClick" style="flex:1;padding:10px"></button>
<button bind [inner-text]="data.text" {click}="onClick" style="flex:1;padding:10px"></button>
</pre>

The button **innerText** property and **click** event are bound to a context as shown below, click the button to see it in action
Expand All @@ -16,13 +16,13 @@ The button **innerText** property and **click** event are bound to a context as
import { bind } from './media/bind.js'

const context = {
text: 'click me',
data: { text: 'click me' },
onClick: e => {
e.stopPropagation();

context.text = 'thanks!';
context.data.text = 'thanks!';
setTimeout(() => {
context.text = 'click me again';
context.data.text = 'click me again';
}, 2000);
}
}
Expand All @@ -31,7 +31,7 @@ The button **innerText** property and **click** event are bound to a context as
</script>

```html
<button bind [inner-text]="text" {click}="onClick"></button>
<button bind [inner-text]="data.text" {click}="onClick"></button>

<script type="module">
import { bind } from './bind.js';
Expand All @@ -41,9 +41,9 @@ The button **innerText** property and **click** event are bound to a context as
onClick: e => {
e.stopPropagation();
context.text = 'thanks!';
context.data.text = 'thanks!';
setTimeout(() => {
context.text = 'click me again';
context.data.text = 'click me again';
}, 2000);
}
};
Expand Down
Loading

0 comments on commit 97754e7

Please sign in to comment.