Skip to content

Commit

Permalink
Cleanup markdown sample code (#61)
Browse files Browse the repository at this point in the history
* Use const/let in sample code

* run eslint on markdown code

* run eslint on markdown code
  • Loading branch information
Christopher Baker authored Feb 15, 2018
1 parent dd7a689 commit 8c70c79
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions can-view-target.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,29 @@ Create a document fragment that can be cloned but have callbacks be
called quickly on elements within the cloned fragment.

```js
var viewTarget = require("can-view-target");
import viewTarget from "can-view-target";

var target = viewTarget([
const target = viewTarget( [
{
tag: "h1",
callbacks: [function(data){
this.className = data.className
}],
callbacks: [ function( data ) {
this.className = data.className;
} ],
children: [
"Hello ",
function(data){
this.nodeValue = data.message
function( data ) {
this.nodeValue = data.message;
}
]
},
]);
}
] );

// target.clone -> <h1>|Hello||</h1>
// target.paths -> path: [0], callbacks: [], children: {paths: [1], callbacks:[function(){}]}

var frag = target.hydrate({className: "title", message: "World"});
const frag = target.hydrate( { className: "title", message: "World" } );

frag //-> <h1 class='title'>Hello World</h1>
frag; //-> <h1 class='title'>Hello World</h1>
```

@param {Array} nodes

0 comments on commit 8c70c79

Please sign in to comment.