adrianhopebailie / web-monetization

Web Monetization Explainer and Specification for submission to the WICG
Other
18 stars 3 forks source link

Rationale for attaching to document? #23

Closed marcoscaceres closed 4 years ago

marcoscaceres commented 4 years ago

Wondering what the rationale was for attaching monetization to the Document object? It doesn't really feel like the right place to attach this, as monetization doesn't itself affect the document or have anything specifically to do with the document interface. We should consider maybe having monetization either on Navigator or its own Monetization namespace.

sublimator commented 4 years ago

Yeah, I'm not sure. I wasn't really around for the beginnings of the spec, but I do recall reading some discussion when starting up. Tracked it down to here: https://github.com/interledger/rfcs/pull/500#discussion_r245246937

sublimator commented 4 years ago

And here: https://github.com/interledger/rfcs/pull/500#issuecomment-452932589 And: https://github.com/interledger/rfcs/pull/500#issuecomment-453173372

To quote @justmoon from comments above:

To give some context: This made more sense to me because Web Monetization is now triggered by a meta-tag and meta-tags describe the document. So whereas previously it was a feature of the JavaScript environment (hence existing on window, it's now a feature of the HTML document.

adrianhopebailie commented 4 years ago

The decision about where to put this was not strongly sided either way. If it's better as a stand-alone global then let's make it a global.

marcoscaceres commented 4 years ago

Yes, putting something in the global namespace would be my preference.

sublimator commented 4 years ago

@marcoscaceres Curious as to why that is. Is that just the prevailing convention, or you have a rationale? or both?? :)

marcoscaceres commented 4 years ago

Is that just the prevailing convention, or you have a rationale? or both?? :)

Bit of both... we generally like to put things on the document that directly affect the Document. You can see what I mean by looking at the interface definition:

https://html.spec.whatwg.org/#the-document-object

In most cases, the methods and attributes affect the Document directly in some meaningful way. Monetization doesn't affect the Document or reflect some sate of the document, so should probably not be hung on that interface.

sublimator commented 4 years ago

Thanks again for the info :)

adrianhopebailie commented 4 years ago

Kamino closed and cloned this issue to interledger/webmonetization.org