Hi guys,

as we're planning to improve some plugin API functions [1,2] I'd like to 
introduce the concept of optional arguments ('options') object, very similar to 
jQuery 'settings' object [3].

Each API function will declare only mandatory (required) arguments as part of 
its signature, with any optional arguments embedded within the 'options' 
object. The 'options' object itself will be optional (can be omitted) and will 
always be the last argument of each API function.

For example:

// Without 'options' object, all optional arguments fall back to their default 
values
showDialog('My Dialog', 'my-dialog', 'http://www.example.com/', '800px', 
'600px')

// With empty 'options' object, all optional arguments fall back to their 
default values
showDialog('My Dialog', 'my-dialog', 'http://www.example.com/', '800px', 
'600px', {})

// With non-empty 'options' object, overriding default 'resizeEnabled' optional 
argument value
showDialog('My Dialog', 'my-dialog', 'http://www.example.com/', '800px', 
'600px', { resizeEnabled: true })

Support for this concept should be part of [1].

Vojtech

[1] http://gerrit.ovirt.org/#/c/11717/
[2] http://gerrit.ovirt.org/#/c/11273/
[3] http://api.jquery.com/jQuery.ajax/
_______________________________________________
Engine-devel mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-devel

Reply via email to