League-of-Foundry-Developers / fvtt-module-popout

FVTT Module PopOut!
Other
29 stars 24 forks source link

3rd party compatibility API #27

Closed sunspots closed 4 years ago

sunspots commented 4 years ago

The new PopOut! version makes it very hard to detect that an application has been popped out. I don't expect PopOut! to fix compatibility issues for other modules, but with some minor additions, we could make our modules compatible by ourselves.

Probably most useful; please emit a hook event with the application object, popout window object and the popout state object after popping out the window, so that third party modules can inspect and handle appropriately.

It would also be great if the PopoutModule object instance was available in the global scope in order to manually access

Third, it would be nice with some way for an application to disable popout completely (e.g. by setting some property on the app object)

I can write pull requests for any of the three features if needed.

kakaroto commented 4 years ago

Hi, thanks for filing this, yes, you make really good point and I agree with all points. I'll try to implement them as soon as I can, but if you're able to do it and send a PR before then, I'll gladly merge it. Thanks!

CarlosFdez commented 4 years ago

So I started messing with OneJournal as a possible alternative to OneNote for most use cases, but lack of popout support was definitely a showstopper to that idea. Digging around brought me to here.

If this is currently not being tackled, 1 and 2 seem easy enough to do, and good for getting more practice with FVTT modules. What should the signature of the event be? My first instinct would be to namespace it to something like "popout:activate" or something but it seems that is not standard practice.

For 3 I can imagine the name being tricky, as Application already has a "popOut" property that conflicts in meaning.

kakaroto commented 4 years ago

I fixed all 3 requests, you can access the singleton object from PopoutModule.singleton, you can disable popout for your window with an option popOutModuleDisable to the Application, and you'll see 3 new hooks, PopOut:popout PopOut.popin and PopOut.dialog, you can see the commits above for more information. If there's anything more needed, let me know!