0.1.56 • Published 7 years ago
@pilotlab/lux-attributes v0.1.56
lux-attributes
A base class wrapper for JavaScript objects that provides events listeners for value changes, serialization methods, and property animation.
Install
sudo npm install --save @pilotlab/lux-attributes
Attribute: Public fields
/*====================================================================*
START: Factory
*====================================================================*/
create:AttributeFactory;
/*====================================================================*
START: Properties
*====================================================================*/
/**
* A UI-friendly title for the attribute that can be presented to users.
* If no label is set, the name of the attribute will be returned.
*/
label:string;
/**
* The value of the associated data.
*/
value:any;
valueTarget:any;
valuePrevious:any;
dataType:DataType;
/**
* Attributes will be considered empty if no name or value has been set.
*/
isEmpty:boolean;
/**
* If this function returns true, the attribute will be omitted from data transfer objects
* when saving data to the data store.
*/
omit:(value:any) => boolean;
validate:(value:any) => any;
onSet:(value:any) => void;
copy:Attribute;
/**
* An automatically generated unique ID that is used when animating attribute values.
*/
animationKey:string;
/*====================================================================*
START: Public Methods
*====================================================================*/
/**
* Save the value to the attribute.
* @returns {boolean} Returns true if a change was made to the attribute value.
*/
set(
value:any,
changeOptions?:ChangeOptions,
omit?:(value:any) => boolean,
isValidate?:boolean
):AttributeSetReturn<AttributeBase<any, any, any, any>>;
/**
* Interrupt any animated value transitions that are in effect.
*/
interrupt():void;
/**
* Manually trigger a dispatch on the 'changed' and/or saveTriggered signals.
*/
doChanged(isSignalChange?:boolean, isSave?:boolean):void;
toObject(isSaveDataTypes?:boolean, appendToObject?:any, isForceInclude?:boolean):any;
toJson(isSaveDataTypes?:boolean):string;
Attributes: Public fields
/*====================================================================*
START: Factory
*====================================================================*/
create:AttributeFactory;
/*====================================================================*
START: Overrides
*====================================================================*/
/// Overrides save(...) to require the value parameter.
set(
name:string,
value:any,
dataType?:DataType,
changeOptions?:ChangeOptions,
index?:number,
omit?:(value:any) => boolean
):AttributeSetReturn<AttributeBase<any, any, any, any>>;
AttributeFactory: Public fields
newNode<any>(createOptions?:AttributeCreateOptions):Attribute;
newCollection(parent?:Attribute):Attributes;
Usage
import {AttributeBase, AttributesBase} from '@pilotlab/lux-attributes';
0.1.56
7 years ago
0.1.55
7 years ago
0.1.53
7 years ago
0.1.51
7 years ago
0.1.49
7 years ago
0.1.48
7 years ago
0.1.47
7 years ago
0.1.46
7 years ago
0.1.45
8 years ago
0.1.44
8 years ago
0.1.43
8 years ago
0.1.39
8 years ago
0.1.38
8 years ago
0.1.35
8 years ago
0.1.32
8 years ago
0.1.28
8 years ago
0.1.26
8 years ago
0.1.23
8 years ago
0.1.22
8 years ago
0.1.16
8 years ago
0.1.12
8 years ago
0.1.9
8 years ago
0.1.8
8 years ago
0.1.7
8 years ago
0.1.6
8 years ago
0.1.5
8 years ago
0.1.4
8 years ago
0.1.3
8 years ago
0.1.2
8 years ago
0.1.0
8 years ago
0.0.13
8 years ago
0.0.12
8 years ago
0.0.11
8 years ago
0.0.10
8 years ago
0.0.9
8 years ago
0.0.8
8 years ago
0.0.7
8 years ago
0.0.6
8 years ago
0.0.5
8 years ago
0.0.4
8 years ago
0.0.3
8 years ago
0.0.2
8 years ago
0.0.1
8 years ago