scientifantastic
2/14/2019 - 7:43 PM

ES6 Class Extends UIComponent

import { UIComponent, UIButton, UIImage, TextFormat, UITextField, UISplitText, TextSplitType } from 'ad-ui'
import { Clamp, Align, Ratio, Styles } from 'ad-view'
import { ObjectUtils } from 'ad-utils'

export default class Bg extends UIComponent {
	constructor(arg) {
		const base = {
			id: 'Bg',
			css: {
				width: '100%',
				height: '100%'
			}
		}
		var merged = ObjectUtils.defaults(arg, base, true)

		super(merged)
		const T = this

		T.txtGreeting = new UITextField({
			id: 'txt-greeting',
			target: T,
			css: {
				width: 200,
				height: 30,
				color: '#ff1414'
			},
			align: Align.CENTER,
			fontSize: 40,
			fontFamily: 'template_font',
			format: TextFormat.INLINE_FIT,
			bufferText: {
				left: 5,
				right: 5
			},
			leading: 1,
			text: 'MOBILE ADS'
		})

		T.doSomthing = function() {
			console.log('DO SOMETHING')
		}

		return T
	}
}