soulwire/sketch.js

Problem with "Undefined"

Simoneth opened this issue · 3 comments

Hi,
Sketch is absolutely AMAZING!

Could you please check this example codepen?
I took the code from your example here
I don't understand why it's not working, there are no reasons I believe.

Best regards

I really wanted to help you, I'm on your code now since maybe 1h30-45, but I tried few things and with some modification, it's seems to work.

So, first, I tried to separate your code, each markup in their right places, script in JS, style in CSS, and guess what ? It works. (codepen). So I integrated your CSS back to his place, and it's cool, ok, no big deal, but I knew that you maybe already tried this, and it worked for you too, but placing all code in one file doesn't works, why ? I don't know really, and I'm sorry for that, but I noticed console's error when all is in same file :

index.html:255 Uncaught TypeError: Cannot read property 'shouldStopExecution' of undefinedsetup
index.html:255 Uncaught TypeError: Cannot read property 'shouldStopExecution' of undefined

Hey hey hey, hello infinite loop, why you aren't stopped by Stopping Infinite Loops?! What about changing this CP.shouldStopExecution, just to see how it reacting ? I just tried something: I've converted example's Coffescript code to Javascript using http://js2.coffee and replace your code by the converted one (results on codepen). It's working, there's no console's error, but it's not what you really wanted.

And I still don't know why your code in same file don't want to work... (if somebody have an answer, I take it) (I personnaly think it's due to CP., but not completly sure)

@idkn Thank you very much for your time.
Yes indeed I spent all the day trying to figured it out what's wrong and I still don't understand why my solution doesn't work, but you save me lots of future headaches.

p.s.
I love your avatar picture! :)

Not sure how you copied the original code, but it seems as if you've inherit some codepen stuff that's nothing to do with the original demo. shouldStopExecution on the CP object is non-standard js and I'm assuming is something codepen inject in order to manage scripts. Have you tried simply forking the original demo?