JSValue UIModule::js_createSlider(const std::vector<JSValue>& arguments, JSObject& this_object)
{
JSObject parameters = get_context().CreateObject();
if (arguments.size() >= 1) {
const auto _0 = arguments.at(0);
TITANIUM_ASSERT(_0.IsObject());
parameters = _0;
}
return createSlider(parameters, this_object);
}
we seem to do this pattern a lot where we pull something out of a argument list, cast it, check the type via assertion, etc.
this is a good place to come up with either an inlined helper function or a macro. makes the code more readable and has the advantage for developers to ensure we have a very common pattern for how to do this logic.
From Jeff's review comments here:
https://github.com/sgtcoolguy/titanium_mobile_windows/commit/c2d07889a2ca6fbb4f689138252003838a42a7e6#commitcomment-9323187
https://github.com/appcelerator/titanium_mobile_windows/pull/202
Closing ticket as fixed.