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

Add a global ReSpec API #3089

Closed
5 of 6 tasks
sidvishnoi opened this issue Aug 24, 2020 · 2 comments
Closed
5 of 6 tasks

Add a global ReSpec API #3089

sidvishnoi opened this issue Aug 24, 2020 · 2 comments

Comments

@sidvishnoi
Copy link
Member

sidvishnoi commented Aug 24, 2020

document.respec = {
  // same as window.respecVersion
  version: string,
  errors: ReSpecError[],
  warnings: ReSpecError[],
  // same as document.respecIsReady
  ready: Promise<void>,
  // catch ReSpec errors/warnings (extends EventTarget)
  addEventListener: ("error" | "warning") => void,
  // export static HTML
  toHTML: () => Promise<string>,
}
@dontcallmedom
Copy link
Member

I'm not sure if it makes sense in this context, but one feature [I needed recently]( which could be hosted in this global API: in a postProcess script in ReSpec, I wanted to use data from the WebIDL parser, but there is no way to access the parser or the parsed IDL tree right

@sidvishnoi
Copy link
Member Author

I'm not sure if document.respec would be the right place to expose this as I would like to keep the API surface as small as possible here to avoid any breaking changes.
FWIW, we do have plans for a new plugins API (See https://github.com/w3c/respec/issues/1976#issuecomment-659673129), where it might be easier to expose this functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants