WICG / webmonetization

Proposed Web Monetization standard
https://webmonetization.org
Other
457 stars 153 forks source link

navigator.monetization.pointer ala document.title <--> <head><title> #233

Closed sublimator closed 1 year ago

sublimator commented 2 years ago

Add JavaScript getter/setter with DOM element "source of truth" similar to how document.title <-> <head>...<title>... works ( JS will add/alter <title> tags )

marcoscaceres commented 2 years ago

I'd be really hesitant to add anything like this. It locks us into a convenience solution that adds indirection (i.e., two ways of getting to the same thing for little benefit). Additionally, if in the future we do allow multiple active monetization links, this will become problematic.

It's better to stick to a single canonical way of getting the active monetization link (i.e., just query for the <link> element). If developers want, they can easily write a JS wrapper to do the same thing as proposed above.

sublimator commented 2 years ago

Yeah, admittedly it's "just DX" which different people value differently. I got the impression most people seem to be against supporting multiple monetization tags, but it seems we aren't ready to commit to that.

marcoscaceres commented 2 years ago

Yeah, admittedly it's "just DX" which different people value differently.

Definitely not something to bake in early. Smaller spec surface === less bugs, less security issues, less problems...

I got the impression most people seem to be against supporting multiple monetization tags, but it seems we aren't ready to commit to that.

Yes, but let's discuss that in #192 so we don't split the discussion.

sublimator commented 2 years ago

Smaller spec surface === less bugs, less security issues, less problems...

lol, can't argue with that generic statement!

It's such a small thing, but would hit so many consumer devs.

marcoscaceres commented 2 years ago

Depends on #192 ... I'd still be inclined to close this.

sublimator commented 2 years ago

Well of course you could just make pointer refer to the first tag in document order fairly easily. I still think in a world where there's support for multiple recipients, most of the time there will be only one and it will still be convenient.

I mean you could make it a pointers list from the get go, and enforce only one to start with ?

Having said that, I'm not super attached to it personally. It's Pete's pet :) But I do think it's kind of hokey to have to mess around using DOM manipulation code to set the recipient dynamically though. Would be nice if we had stats on how often that happens vs static templating.

sublimator commented 2 years ago

image

haha

marcoscaceres commented 2 years ago

Reopening as it will automatically close when we merge the PR. There is still a good discussion to be had here maybe around a WM JS library.

sublimator commented 1 year ago

After messing around with link headers last year, I wondered again if some kind of unified getter may actually make sense