Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

document.monetization vs global #24

Closed
adrianhopebailie opened this issue Oct 14, 2019 · 15 comments
Closed

document.monetization vs global #24

adrianhopebailie opened this issue Oct 14, 2019 · 15 comments
Assignees
Labels
enhancement New feature or request pr193 New Web Monetization Specification Proposal

Comments

@adrianhopebailie
Copy link
Collaborator

From web-monetization created by marcoscaceres: adrianhopebailie/web-monetization#23

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.

@adrianhopebailie
Copy link
Collaborator Author

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.

@adrianhopebailie
Copy link
Collaborator Author

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

@adrianhopebailie
Copy link
Collaborator Author

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

@adrianhopebailie
Copy link
Collaborator Author

And here:
interledger/rfcs#500 (comment)
And:
interledger/rfcs#500 (comment)

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
Copy link
Collaborator Author

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: interledger/rfcs#500 (comment)

@adrianhopebailie
Copy link
Collaborator Author

Thanks again for the info :)

@adrianhopebailie
Copy link
Collaborator Author

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.

@adrianhopebailie adrianhopebailie changed the title Rationale for attaching to document? document.monetization vs global Oct 15, 2019
@adrianhopebailie
Copy link
Collaborator Author

PROPOSAL

Based on the discussion so far we should move the Monetization interface off of document and make it a global.

We can leave the existing document.monetization interface for backwards compatibility but mark it as deprecated.

This would also allow us to define a new API shape that takes into account the various other suggestions such as:

Please respond to this proposal with either an 👍 or a 👎

If you are 👎 on this proposal please provide rationale below

@adrianhopebailie adrianhopebailie added the question Further information is requested label Oct 15, 2019
@sublimator
Copy link
Collaborator

End of the day tired, but I'm in favor of this:

I can't imagine doing the donkey work of getting this working being that hard.
We just need to decide to move in this direction.

For:

  1. Making whatever we see as enduring changes as soon as possible would mean less
    changes later.
  2. We wouldn't have to change the meaning of pending on
    document.monetization, which is a subtly breaking change.

Against:

  1. I can't really see any downside, except that it's not exactly an ongoing release/versioning strategy so much as a one time opportunity.

Generally, the end users (i.e. extension users) are going to have the most up-to-date extension released due to automatic updates.

Integrators are going to have a less easy time of it. Putting some thought into release management/explicit api versioning might help us (document.monetization ~= v2, window.monetization ~= v3 is only implied)

e.g.

// the first thing that comes to mind, but an illustration of what I mean
window.monetization.draft1.monetizationStream(...) 

@sharafian
Copy link
Collaborator

I have a preference for holding off these renaming-type changes for the last minute so that we can group them all together

@adrianhopebailie
Copy link
Collaborator Author

CONCLUSION: Move monetization to global

@sublimator
Copy link
Collaborator

@marcoscaceres
Copy link
Contributor

it still feels safer to put it on Navigator, tbh (to avoid any potential collisions with existing user-land code). I think there is also W3C TAG guidance around this... though I can't remember where.

Sorry also about not responding above. There were other issues too, with Document... like a page can have/create multiple Documents (e.g., via document.implementation.createDocument()).

Anyway, the point in kinda mute if we are willing to shift it elsewhere.

@mankins
Copy link

mankins commented Jul 29, 2021

Navigator makes sense to me.

I do wonder if monetization is actually too broad and it should be webmon or something more specific instead? There are multiple different ways to monetize a site (and multiple ways to spell monetise) ...

@marcoscaceres marcoscaceres self-assigned this Nov 30, 2021
@marcoscaceres marcoscaceres added sf-actionable and removed question Further information is requested labels Nov 30, 2021
@AlexLakatos AlexLakatos added the pr193 New Web Monetization Specification Proposal label Dec 3, 2021
@huijing
Copy link
Collaborator

huijing commented Jun 27, 2023

Resolved by #193

@huijing huijing closed this as completed Jun 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request pr193 New Web Monetization Specification Proposal
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants