nv-cli-webidl

nv-cli-webidl =============== - nv-cli-webidl - offline cli tool, to show webidl defined interface - it maybe useful when migrating to js-implement from other language

Usage no npm install needed!

<script type="module">
  import nvCliWebidl from 'https://cdn.skypack.dev/nv-cli-webidl';
</script>

README

nv-cli-webidl

  • nv-cli-webidl
  • offline cli tool, to show webidl defined interface
  • it maybe useful when migrating to js-implement from other language

install

  • npm install nv-cli-webidl -g

usage

examples

parse

@# nv_webidl -p

interface AccessibleNode {
    readonly attribute sequence<DOMString> states;
};


//press ctrl+D

special:  undefined
[
    {
        "type": "interface",
        "name": "AccessibleNode",
        "inheritance": null,
        "members": [
            {
                "type": "attribute",
                "name": "states",
                "idlType": {
                    "type": "attribute-type",
                    "extAttrs": [],
                    "generic": "sequence",
                    "nullable": false,
                    "union": false,
                    "idlType": [
                        {
                            "type": "attribute-type",
                            "extAttrs": [],
                            "generic": "",
                            "nullable": false,
                            "union": false,
                            "idlType": "DOMString"
                        }
                    ]
                },
                "extAttrs": [],
                "special": "",
                "readonly": true
            }
        ],
        "extAttrs": [],
        "partial": false
    }
]

intf srch

@# nv_webidl -i | egrep "^Event"
Event
EventHandler
EventListener
EventSource
EventTarget

json format

@# nv_webidl -j "^source.*list"


#SourceBufferList :

[
    {
        "type": "interface",
        "name": "SourceBufferList",
        "inheritance": "EventTarget",
        "members": [
            {
                "type": "attribute",
                "name": "length",
                "idlType": {
                    "type": "attribute-type",
                    "extAttrs": [],
                    "generic": "",
                    "nullable": false,
                    "union": false,
                    "idlType": "unsigned long"
                },
                "extAttrs": [],
                "special": "",
                "readonly": true
            },
            {
                "type": "attribute",
                "name": "onaddsourcebuffer",
                "idlType": {
                    "type": "attribute-type",
                    "extAttrs": [],
                    "generic": "",
                    "nullable": false,
                    "union": false,
                    "idlType": "EventHandler"
                },
                "extAttrs": [],
                "special": "",
                "readonly": false
            },
            {
                "type": "attribute",
                "name": "onremovesourcebuffer",
                "idlType": {
                    "type": "attribute-type",
                    "extAttrs": [],
                    "generic": "",
                    "nullable": false,
                    "union": false,
                    "idlType": "EventHandler"
                },
                "extAttrs": [],
                "special": "",
                "readonly": false
            },
            {
                "type": "operation",
                "name": "",
                "idlType": {
                    "type": "return-type",
                    "extAttrs": [],
                    "generic": "",
                    "nullable": false,
                    "union": false,
                    "idlType": "SourceBuffer"
                },
                "arguments": [
                    {
                        "type": "argument",
                        "name": "index",
                        "extAttrs": [],
                        "idlType": {
                            "type": "argument-type",
                            "extAttrs": [],
                            "generic": "",
                            "nullable": false,
                            "union": false,
                            "idlType": "unsigned long"
                        },
                        "default": null,
                        "optional": false,
                        "variadic": false
                    }
                ],
                "extAttrs": [],
                "special": "getter"
            }
        ],
        "extAttrs": [
            {
                "type": "extended-attribute",
                "name": "Pref",
                "rhs": {
                    "type": "string",
                    "value": "\"media.mediasource.enabled\""
                },
                "arguments": []
            }
        ],
        "partial": false
    }
]

webidl format

@# nv_webidl -w "^source.*list"


#SourceBufferList :

/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */

/* This Source Code Form is subject to the terms of the Mozilla Public

 * License, v. 2.0. If a copy of the MPL was not distributed with this file,

 * You can obtain one at http://mozilla.org/MPL/2.0/.

 *

 * The origin of this IDL file is

 * http://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html

 *

 * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C

 * liability, trademark and document use rules apply.

 */



[Pref="media.mediasource.enabled"]

interface SourceBufferList : EventTarget {

  readonly attribute unsigned long length;

  attribute EventHandler onaddsourcebuffer;

  attribute EventHandler onremovesourcebuffer;

  getter SourceBuffer (unsigned long index);

};

LICENSE

  • ISC