Skip to content
Snippets Groups Projects
  • Piotr Brzeziński's avatar
    35a238b6
    gstwebrtc-api: Improve JSDocs, add TypeScript type definitions · 35a238b6
    Piotr Brzeziński authored and GStreamer Marge Bot's avatar GStreamer Marge Bot committed
    * Moves some parts of the docs around to make them better parseable by
    JSDoc (e.g. @classdesc moved to the constructor gets rid of duplicated
    doc page for the entire class)
    
    * Gets rid of unnecessary manual assignment of methods/properties
    example: @method GstWebRTCAPI#createConsumerSession
    Due to a bug in JSDoc, it doesn't automatically pick up docs in classes
    marked with 'export default class ...'. Just making the export separate
    is enough to fix this. I suppose this bug was why every documented part
    was manually assigned to each class, and this is no longer necessary.
    
    * Removes forced GstWebRTCAPI namespace from docs
    I'm not sure why things were left this way, but at least since
    563eff11 our classes aren't actually in
    any namespace (well, maybe apart from SessionState?), you can import
    them one by one and no such namespace is present anywhere. I removed
    that, kind of as a byproduct of the point above.
    
    * Removes external: from type references
    This is problematic because JSDoc handles this fine, but any IDE I've
    tried couldn't parse those references correctly from the JSDocs, and
    neither could the TypeScript compiler when autogenerating type
    definitions. After removing the external: prefix, all tooling is picking
    those types up fine, but JSDoc's docs end up losing links when refering
    to said types. I left the definitions in index.js, so that they still
    show up in the sidebar and can be easily referred to.
    
    * Adds TypeScript type definitions (d.ts)
    Those are autogenerated by running `npx tsc` in the main dir and then
    manually corrected by 1) removing all undocumented ('private') functions
    and 2) writing definitions for the Listener interfaces which TS can't
    automatically infer from JSDocs. This makes it much easier to use our
    library in TypeScript-based projects.
    
    Part-of: <!2049>
    35a238b6
    History
    gstwebrtc-api: Improve JSDocs, add TypeScript type definitions
    Piotr Brzeziński authored and GStreamer Marge Bot's avatar GStreamer Marge Bot committed
    * Moves some parts of the docs around to make them better parseable by
    JSDoc (e.g. @classdesc moved to the constructor gets rid of duplicated
    doc page for the entire class)
    
    * Gets rid of unnecessary manual assignment of methods/properties
    example: @method GstWebRTCAPI#createConsumerSession
    Due to a bug in JSDoc, it doesn't automatically pick up docs in classes
    marked with 'export default class ...'. Just making the export separate
    is enough to fix this. I suppose this bug was why every documented part
    was manually assigned to each class, and this is no longer necessary.
    
    * Removes forced GstWebRTCAPI namespace from docs
    I'm not sure why things were left this way, but at least since
    563eff11 our classes aren't actually in
    any namespace (well, maybe apart from SessionState?), you can import
    them one by one and no such namespace is present anywhere. I removed
    that, kind of as a byproduct of the point above.
    
    * Removes external: from type references
    This is problematic because JSDoc handles this fine, but any IDE I've
    tried couldn't parse those references correctly from the JSDocs, and
    neither could the TypeScript compiler when autogenerating type
    definitions. After removing the external: prefix, all tooling is picking
    those types up fine, but JSDoc's docs end up losing links when refering
    to said types. I left the definitions in index.js, so that they still
    show up in the sidebar and can be easily referred to.
    
    * Adds TypeScript type definitions (d.ts)
    Those are autogenerated by running `npx tsc` in the main dir and then
    manually corrected by 1) removing all undocumented ('private') functions
    and 2) writing definitions for the Listener interfaces which TS can't
    automatically infer from JSDocs. This makes it much easier to use our
    library in TypeScript-based projects.
    
    Part-of: <!2049>