asticode / go-astilectron-bundler

Bundle your Astilectron app with ease
MIT License
129 stars 68 forks source link

Cannot open dev tools #72

Closed damiandominella closed 4 years ago

damiandominella commented 4 years ago

I'm trying to open the console in my application window, using the method w.OpenDevTools() but I cannot make it. I'm maybe doing something wrong when trying to use the w object?

var (
    debug   = flag.Bool("d", true, "enables the debug mode")
    w       *astilectron.Window
)
// ...
if err := bootstrap.Run(bootstrap.Options{
        // ...
        Windows: []*bootstrap.Window{{
            Homepage:       "index.html",
            MessageHandler: handleMessages,
            Options:        &astilectron.WindowOptions{},
        }},
    }); err != nil {
        l.Fatal(fmt.Errorf("running bootstrap failed: %w", err))
    }

w.OpenDevTools()
damiandominella commented 4 years ago

I've also tried with Ctrl + D, or by clicking the Debug menu options, but I obtain the following error:

Astilectron says: {"name":"menu.item.event.clicked","targetID":"8","menuItemOptions":{"checked":true,"enabled":true,"label":"Debug","visible":true}} panic: runtime error: invalid memory address or nil pointer dereference

iangallOlive commented 4 years ago

@damiandominella I know you only posted a snippet of your code, but it doesn't look like you assign a value to w. Have you done this assignment?: https://github.com/asticode/go-astilectron-demo/blob/master/main.go#L79

damiandominella commented 4 years ago

@iangallOlive I was missing that part by removing the OnWait property, now I can correctly access the w. Thanks.