Skip to content

Instantly share code, notes, and snippets.

@jrabbit
Last active March 16, 2016 10:57
Show Gist options
  • Save jrabbit/b82c9bd271878cc98d26 to your computer and use it in GitHub Desktop.
Save jrabbit/b82c9bd271878cc98d26 to your computer and use it in GitHub Desktop.
<article>
<div id='yourElement'></div>
<ol id="isbnList">
{%verbatim%}
<template id="t" is="dom-bind">
<template is="dom-repeat" items="{{data}}">
<div><span>{{item}}</span> </div>
</template>
</template>
{% endverbatim %}
</ol>
</article>
<script type="text/javascript">
Quagga.init({
inputStream : {
name : "Live",
type : "LiveStream",
target: document.querySelector('#yourElement') // Or '#yourElement' (optional)
},
decoder : {
readers : ["ean_8_reader", "ean_reader"]
}
}, function(err) {
if (err) {
console.log(err);
return
}
console.log("Initialization finished. Ready to start");
Quagga.onDetected(function(data){
console.log(data.codeResult.code)
document.querySelector("#t").push('data', data.codeResult.code)
})
document.querySelector("#t").data = []
Quagga.start();
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment