How do I reactively initialize a Switchery checkbox?


#1

abpetkov:switchery requires this kind of initialization:

var elems = Array.prototype.slice.call(document.querySelectorAll('.js-switch'));

elems.forEach(function(html) {
    var switchery = new Switchery(html, { size: 'small' });
});

I am adding one Switchery checkbox per document in a collection using {{each}}. I tried to run the above initialization lines on render, but now I need to run it reactively when new records are inserted; preferably just for the new records. How do I do that?