Skip to content

Commit

Permalink
Update wg-api/best-practices.md
Browse files Browse the repository at this point in the history
Co-authored-by: Will Anderson <will@itsananderson.com>
  • Loading branch information
samuelmaddock and itsananderson authored Oct 3, 2024
1 parent 1b04d27 commit 1ea5033
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions wg-api/best-practices.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@ function whatever(opts: { a: string, b?: boolean }) { /* ... */ }

See https://w3ctag.github.io/design-principles/#prefer-dict-to-bool for more details.

### Should the configured options be made extensible to third-party libraries?
### How will third-party libraries interact with this API?

When designing an API, consider that an app might have custom code and third-party libraries that both interact with that API. Can the API be designed so that multiple callers don't interfere with each other?

If an API accepts configuring options, should it provide the ability to append to rather than replace those options?
Would third-party libraries require special attention to API usage to avoid clobbering configured options?
Can third-party libraries use the API without knowing what app-specific code is also using the API?

See the [style guide for designing APIs when dealing with arrays.](#provide-createreadupdatedelete-options-when-dealing-with-arrays)

Expand Down

0 comments on commit 1ea5033

Please sign in to comment.