JSPAEvent
These are raised via data-bind-click
, and data-bind-load
class JSPAEvent {
public $el: JQuery = null; // the element its bound to
public component: Component = null; // the whole component
public data: any = null; // the data at bind time, eg array item
public value: any = null; // function call value, string
public evt: any = null; // the JQuery event
constructor(obj: { $el: JQuery, component: Component, data: any, value: any, evt: any }) {
// map what ever is passed in to the members of this class that actually exist, ignoring everything else
let _internal: any = obj;
for (let m in this) {
this[m] = _internal[m];
}
}
};
Usage
<button data-bind-click="uiClickEvent" />
OR
<button data-bind-click="uiClickEvent(aStringValue)" />
class ClickComponent extends Component {
private uiClickEvent(src: JSPAEvent){
}
}
JSPAEmit
This is used by JSPA components to send information back to parent components
class JSPAEmit {
src: string;
data: any;
$parent: JQuery;
error: any;
constructor(src?: string, data?: any, $parent?: JQuery, error?: any) {
this.src = src || null;
this.data = data || null;
this.$parent = $parent || null;
this.error = error || null;
}
}
Usage
class ChildComponent extends Component {
constructor(parent: Component) {
super([
// templates
], parent) {
}
}
private internalFunction() {
let someData = {
primative: 1,
obj: {},
array: []
}
this.emit(someData);
}
}
JSPAColour
Returned by Utils.colourConvert(input: string)
NB: Alpha on rgba()
strings is ignored.
class JSPAColour {
public hex: string = null;
public rgb: string = null;
public r: number = null;
public g: number = null;
public b: number = null;
}
Usage
let colour = new Utils().colourConvert("#fff");
let colour = new Utils().colourConvert("#ddff23");
let colour = new Utils().colourConvert("rgb(25,12,34)");
let colour = new Utils().colourConvert("rgba(255,12,34,0.5");