Sometimes our functions only take a few required arguments or need to be fast to call, e.g.,
var pick = scene.pick(movement.endPosition);
Other times, performance is less important and our functions have lots of optional arguments combined into an object literal, e.g.,
var blackMarble = new TileMapServiceImageryProvider({
url : ‘http://cesium.agi.com/blackmarble’,
maximumLevel : 8,
credit : ‘Black Marble imagery courtesy NASA Earth Observatory’
});
Other times we have a few required arguments, and then an optional object literal with optional arguments, e.g.,
scene.getAnimations().addProperty(extentSlice, ‘height’, extentSlice.height, id.top, {
duration : 600,
onComplete : function() {
animatingExtentSlice = false;
},
easingFunction : Cesium.Tween.Easing.Cubic.InOut
});
Years ago, Scott and I agreed on this. After dog-fooding this at the hackathon last week, I find the last convention awkward and the opposite of self-documenting. I want to suggest that we always prefer a single object literal in those cases unless speed is critical (which it was not in all the cases I came across). Looks like OpenLayers 3 has similar (perhaps implicit) conventions, e.g., http://ol3js.org/en/master/examples/kml.js
I’m not looking to make a sweeping change now, but if we agree, I’ll create an issue to clean things up.
Patrick