This is the API for the actions used by ideckia.
- Layout: Bunch of items
- Item: An element that has one or more states and is clickable.
- State: Definition of the item status: text, textColor, bgColor, icon and some actions which will be executed when the item is pressed.
- Action: Action which will be fired (can be more than one in a state) in the host computer when the item is pressed in the client.
- setup(props, core):Void
- Needs to be implemented, autogenerated with macros in haxe.
- Core will call to this method to inject the configuration of the action instance
- Parameters:
- props: Properties defined for the instance in the layout file
- core: Object to access to some tools that ideckia_core offers:
- log: Logs in the core process:
- error(text:String): Logs in ERROR level
- debug(text:String): Logs in DEBUG level
- info(text:String): Logs in INFO level
- dialogs: Access to host dialogs. The dialog property is an implementation of IDialog
- mediaPlayer: Access to host media player. The mediaPlayer property is an implementation of IMediaPlayer
- updateClientState: a function to send to the client the state of the item.
- data: A collection of methods for working with data
- getCurrentLang: Get the language configured for the app.
- getContent:(path:String): Reads and returns the content of the given path as String.
- getJson:(path:String): Read and returns the content of the given path parsed as JSON.
- getTranslations:(path:String): Read and returns the content of the given path parsed as Translations.
- getBytes:(path:String) -> Reads and returns the content of the given path as haxe.io.Bytes.
- getBase64:(path:String) -> Reads and returns the content of the given path as String encoded in Base64.
- log: Logs in the core process:
- init(initialState:ItemState):Promise
- Entry point.
- The core will call to this once, to initialize what you need.
- execute(currentState:ItemState):Promise
- Needs to be implemented.
- The core will call when the associated item is clicked.
- Parameters:
- The actual state of the item when it is clicked.
- The function will return the Promise of a new state of the item or a directory items. See TActionOutcome
- onLongPress(currentState:ItemState):Promise
- The core will call when the associated item is long pressed.
- Parameters:
- The actual state of the item when it is long pressed.
- The function will return the Promise of a new state of the item or a directory items. See TActionOutcome
- getStatus():Void
- Method called from the editor to show if the action has any problems.
- show(currentState:ItemState):Promise
- Method called when the state that belongs this action shows up.
- hide():Void
- Method called when the state that belongs this action goes out of sight.
- getActionDescriptor():Promise (Used by the editor)
- Needs to be implemented, autogenerated with macros in haxe.
- This will return action descriptor structure which will be used by an editor
The returned text can have different size, color and style (bold, italic, underline) parts. The format is {transformer:text to transform}
. The transformer can be:
b
: Thetext to transform
will be boldi
: Thetext to transform
will be italicu
: Thetext to transform
will be underlinedcolor.colorName
: Thetext to transform
will be rendered incolorName
color.size.fontSize
: Thetext to transform
will be rendered infontSize
size.
The changes can be chained. For example:
The text is {b:{i:{u:bold, italic and underlined}}}. And this text will be {color.red:{size.50:colored with red and BIG}}