reTHINK-project / dev-runtime-browser

Apache License 2.0
0 stars 3 forks source link

Browser Runtime close() #54

Closed pchainho closed 8 years ago

pchainho commented 8 years ago

The Browser Runtime should only be closed when the runtimeUA.close() promise is resolved ie after unregister all Hyperty instances.

See https://github.com/reTHINK-project/dev-runtime-core/issues/89

dvilchez commented 8 years ago

@pchainho I did the changes but I can't test them because this https://github.com/reTHINK-project/dev-runtime-core/issues/102, btw I found another problem https://github.com/reTHINK-project/dev-service-framework/issues/52

dvilchez commented 8 years ago

@pchaino what do you mean with close runtime browser? I only have exposed the close method on runtime to app developer, is required something more?

pchainho commented 8 years ago

The close() function is to be called by the runtime browser when you detect browser window / tab close events. Having a function exposed to App developers is also nice

dvilchez commented 8 years ago

@pchainho I afraid we can't postpone browser window/tab close until runtimeUA.close returns. There are some technics but all of them are poor options. In addition we can face another problem here:

User agents will typically ignore asynchronous XMLHttpRequests made in an unload handler. from: https://developer.mozilla.org/en-US/docs/Web/API/Navigator/sendBeacon

I don't know about websocket.

How would you like to proceed?

pchainho commented 8 years ago

let's invoke close() even if we don't guarantee the window/tab close is blocked until the promise is resolved. At least we've tried to unregister components. If not successful, the Domain Registry is currently able to "clean dead" registry entries

dvilchez commented 8 years ago

done in c024ae2bd2d00e557780fe47fe8c58692f82424c