Search code examples
javascriptreactjsautodesk-forgeautodesk-viewer

Autodesk forge Viewer in React Application markup extension`s not all functions don`t come


I have a React Apllication and integrated Autodesk forge viewer. I have a markup extension for viewer and its work correctly without React. When i try to add extension to React viewer, extensions functions are loaded not fully (all functions beside onToolbarCreated). I need to know where i must include extensions javascript file and why onToolbarcreated function is not loaded?

i got this error in console`

error in console

Extension code here


Solution

  • A few things to check here:

    • onToolbarCreated is only effective when using Viewer v7 or later
    • it'd only get called after the Autodesk.Viewing.TOOLBAR_CREATED_EVENT event is fired
    • you can either add a breakpoint inside your function or print to the console in there to detect if and when it's called instead of printing it to the console in your load callback ...