How to interpret API documentation function parameters?

后端 未结 4 661
有刺的猬
有刺的猬 2020-11-22 00:35

Is there a standard to interpret the syntax of function interfaces in API documentations and if yes, how is it defined?

Here is an example on how to change the color

4条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2020-11-22 01:20

    The brackets mean that the property is optional. Be aware though that if you want to set some property at the nTh rank, you have to either declare properties for the leading one or declare them as undefined :

    fillPath() //good
    fillPath ( someFillColor ) //good
    fillPath ( someFillColor, mode ) //good
    fillPath ( undefined, mode ) //good
    fillPath ( mode ) //bad
    fillPath ( undefined ) //really bad
    

提交回复
热议问题