s-yadav/patternLock

lock.reset(); error

youcanping opened this issue · 2 comments

I install use npm
version is this "patternlock": "^2.0.1"
but, this version lock.reset(),has error;

util.js?e787:77 Uncaught TypeError: Cannot read property 'removeChild' of null
    at eval (util.js?e787:77)
    at Array.forEach (<anonymous>)
    at remove (util.js?e787:76)
    at HTMLDocument._onEnd (PatternLock.js?0d62:520)

so , I copy you demo's script is ok, demo's version is show this:

 patternLock.js v 1.0.1
    Author: Sudhanshu Yadav
    Copyright (c) 2015,2016 Sudhanshu Yadav - ignitersworld.com , released under the MIT license.
    Demo on: ignitersworld.com/lab/patternLock.html

I will check this. This could be on recent rewrite. I have not updated the demo page yet.

this is my testing bug, but set timeout is ok! 😄

// test code with errow
lock.option("onDraw", function(){
   lock.reset(); //has error
})
// is ok
lock.option("onDraw", function(){
  setTimeout(function(){
    lock.reset();// is ok
}, 200);
})