patcg-individual-drafts / private-aggregation-api

Explainer for proposed web platform API
https://patcg-individual-drafts.github.io/private-aggregation-api/
41 stars 17 forks source link

Ergonomics: `contributeToHistogram` could accept an array of contributions #70

Open yoavweiss opened 1 year ago

yoavweiss commented 1 year ago

Continuing the discussion from #44

alexmturner commented 1 year ago

When making this change, we will need to consider how developers will be able to feature detect this and support versions both with and without this change.

As this is purely syntactic sugar, developers could always just pass each contribution individually to the function and that may be the easiest way to support both versions (although this does defeat the purpose of the change a little). It would also be possible to try/catch a TypeError when passing an array.

If we want to make feature detection simpler, we could consider a different name for this function that takes an array, e.g. contributeArrayToHistogram().