Closed
Description
Question as to why you used the builder pattern instead of a configuration object pattern for configuring instances.
The following has ten total method calls just for one button.
var CustomButton = new MKButton.Builder()
.withBackgroundColor(MKColor.Teal)
.withShadowRadius(2)
.withShadowOffset({width:0, height:2})
.withShadowOpacity(.7)
.withShadowColor('black')
.withOnPress(() => {
console.log('hi, raised button!');
})
.withTextStyle({
color: 'white',
fontWeight: 'bold',
})
.withText('RAISED BUTTON')
.build();
The MooTools configuration pattern uses just one
var CustomButton = new MKButton({
backgroundColor : MKColor.Teal,
shadow : {
radius : 2,
opacity : .7,
color : 'black',
offset : {
width : 0,
height : 2
}
},
textStyle {
color : 'white',
fontWeight : 'bold'
},
onPress : () => {
console.log('onPress')
}
});