The implementation of window.luisSnap in Javascript.