khchen / wNim

Nim's Windows GUI Framework
MIT License
327 stars 17 forks source link

expose getWeb() and browser to integrated with libp2p #75

Closed gogolxdong closed 3 years ago

gogolxdong commented 3 years ago

There is a requirement of release resource for the else branch in webView.goBack() in my application and here are corresponding two solutions which I can think of, one is adding a closure parameter like

proc goBack*(self: wWebView, action: proc()) {.validate, inline.} =
  ## Navigate back.
  let web = self.getWeb()
  if web.canGoBack:
    web.browser.GoBack()
  else:
    action()

another is exposing those and disable the assertion. Which do you prefer? BTW, this is really the best windows GUI framework in Nim, thanks for your contribution!

khchen commented 3 years ago

Sorry, I cannot catch your problem. Why not use proc canGoBack*(self: wWebView): bool ? I think exposing ptr IWebBrowser2 is reasonable, but not getWeb(), it returns a private object that may be changed later.