Skip to content
This repository was archived by the owner on Nov 25, 2020. It is now read-only.

vweevers/reactive-skip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

reactive-skip

Plugin for reactive to conditionally skip processing of an element. Adds a data-skip binding.

Jump to: Example - Install - License

Build Status

Example

<section data-skip="{ name == 'hank'}">
  <h1 on-click="ignored">hey now</h1>
  <p>no {interpolation} here</p>
</section>
<section data-skip="false">
  <h1>{name} is happy</h1>
</section>
var reactive = require('reactive')
  , skip = require('reactive-skip')

reactive(template, {name: 'hank'}, {
  bindings: {
    'data-skip': skip.binding
  }
})

Alternatively, do:

var view = reactive(template, {name: 'hank'})
view.use(skip)

But note, in this case the template is processed entirely before the plugin is loaded.

Install

npm i reactive-skip

Then use browserify to bundle for the browser.

License

MIT © Vincent Weevers

About

Conditionally skip processing of an element

Resources

Stars

Watchers

Forks

Packages

No packages published