sending code to puck.js causes reset() error

Posted on
  • Hi all,

    been working with the puck.js for a while now and every now and then I get an error upon loading code (via WebBT/Chrome) to my puck.

    It seems to trigger a reset which seems to fail:

    Uncaught Error: Expecting a function to call, got Number
    at line 1 col 1
    reset();
    ^

    See also attached screenshot - this happens even when just loading one line of code to the puck...

    (hard-)resetting the puck fixes that for a while, but the issue eventually comes back.

    Any ideas?


    1 Attachment

    • Screenshot 2019-12-19 at 10.15.50.png
  • ...since the console.log() uses the same and only available 'communication channel' it interferes with the upload... therefore, put your code into a setTimeout() function, or - even better - into 'the' onInit(){ ... } function and add the timeout to the code like this:

    function onInit() {
      // your code
    }
    
    setTimeout(onInit,999); // while dev, remove before upload for save()
    
  • Thanks for explaining the background on the communication channel - seeing this I now understand the reason for the error.

    Using your code snippet fixed the error, thanks for that, also!

  • I'm not sure if this helps, but:

    Expecting a function to call, got Number
    at line 1 col 1
    reset();
    

    would happen if you did something like global.reset=1 which set reset to a number. It seems unlikely that you would have done that however

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

sending code to puck.js causes reset() error

Posted by Avatar for dysc @dysc

Actions