addOpener getViewClass api?


#1

I have been looking everywhere trying to figure out the API that is expected when using addOpener(). I have seen people mention the html-tab package and that shows a fairly simple view class but it doesn’t answer several questions (and space-pens documentation is sorely lacking).

  1. What are the lifecycle methods for the returned opener object? I know about getTitle(), getElement(), getURI(), getViewClass(), and the others mentioned in the tutorial and html-tab package, but I would like a comprehensive list.
  2. If I use the getViewClass() lifecycle method how do I access the instance? The space-pen docs say you can call methods on instantiated views, but how do I gain access to an instantiated view?
  • ASIDE
    I am growing increasingly frustrated with Atom’s documentation and their tendency to move away from simple clean technologies like CoffeeScript and space-pen in favor of more complicated things like TypeScript and …whatever is taking space-pens place (can’t even find a name for it). It’s as if they can’t make up their minds on anything (probably a pitfall of open-source programming).

#2

I have a half-developed package where I implemented addOpener(). Like you, I found the API documentation less than crystal clear about what needed to happen, but I figured it out. That package is an exploration into getting Atom to open a file without doing all the normal Atom things and just loading it in as plain text. The opener and basic package functionality worked last I checked (a few versions ago); there were just some kinks in the navigation behavior that I had to work out, so you can trust the parts of the code that implement the opener itself.