javascript - PatternLock temporary disable in jQuery/JS -
i'm using third party library emulate 3x3 android pattern lock screen using js , jquery.
repo: https://github.com/s-yadav/patternlock
emulator: http://ignitersworld.com/lab/patternlock.html#intro
i add disable() , enable() functions patternlock.prototype, in order disable user's ability draw new patterns while routine running save pattern drew previously. user need able see pattern not draw new pattern until routine on , lock re-enabled.
what's best way this? built-in event handlers anonymous functions shy away using .off() , .on(). adding class "patt-hidden" still allows new pattern show after it's drawn, not while being drawn. know direction go, or have tried writing disable method before?
this inelegant, able hack adding global boolean var disabled = false pattern.js, toggled in 2 helper functions enabled() , disable() in patternlock prototype. run check @ beginning of each event handler, exits if disabled===true. recent pattern selected stays visible lock throws empty click events until re-enabled.
i love hear more efficient solution.
Comments
Post a Comment