[ 
https://issues.apache.org/jira/browse/CB-4089?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16088129#comment-16088129
 ] 

Filip Maj commented on CB-4089:
-------------------------------

Worth noting that while argument _types_ are validated in most core Cordova 
plugins (see 
https://github.com/apache/cordova-js/blob/master/src/common/argscheck.js#L39), 
properties on object parameters (such as used in your example) are not 
validated.

Agree that the docs for authoring plugins could probably cover this fact, and 
also point folks to the existing cordova-js utility methods such as 
{{argsCheck}} (and maybe worth showing examples using some code cordova plugin 
code).

> Undocumented API rule? Passing invalid option values uses default value 
> instead.
> --------------------------------------------------------------------------------
>
>                 Key: CB-4089
>                 URL: https://issues.apache.org/jira/browse/CB-4089
>             Project: Apache Cordova
>          Issue Type: Improvement
>          Components: cordova-docs
>    Affects Versions: 2.7.0
>            Reporter: Peter
>            Assignee: Michael Brooks
>            Priority: Minor
>
> It looks like there is some undocumented rule such that if an _invalid_ 
> option value is passed via a Cordova API then the _default_ value will be 
> used instead.
> For example, the following calls are all equaivalent:
> {code}
> navigator.globalization.dateToString(new Date(), win, fail, {selector: 
> 'banana'}) 
> navigator.globalization.dateToString(new Date(), win, fail, {selector: 'date 
> and time'}) 
> navigator.globalization.dateToString(new Date(), win, fail, {}) 
> {code}
> I had (wrongly) expected 'banana' would result in some kind of API error 
> since it is not a supported value for the selector.
> This undocumented API rule should be documented.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org

Reply via email to