AppBuckets Phaser Module
npm install @appbuckets/phaserPhaserPhaser is a npm Module which allows you to create a log of all the actions you want.Task()Phaser takes to create a Task.namestringactionFunctioncomplete() Method it means that it is successfully completed.result parameter the result of the action. #### Params
- result
- type: any
- description: You can pass as result the returned value of the action Function from the task constructor.
___
error() Method it means that an error is occurred. #### Params
- err
- type: String
- description: This string is displayed in the Log as a description of the Error
- default: Generic Error
___
warning() Method it means that a warning is occurred. warnBooleanfatal() Method it means that a fatal error is occurred. #### Params
- err
- type: String
- description: This string is displayed in the Log as a description of the Error
- default: Generic Error
___
#### Params
- name
- type: String
- description: The Name of the counter
- initial
- type: Number
- description: The initial value of the Counter. By default it is zero
- default: 0
- state
- type: String
- description: The state of the Counter. It can be 'normal', 'warning' or 'error'
- default: normal
___
Phaser()Phaser has got. Phaser object.#### Params
- description
- type: String
- description: The title of the new Phase
- options
- type: Object
- description: Some options for the Phase
- autoStart
- type: Boolean
- description: If it is 'true' the Phase will start automatically, otherwise it requires to call the start() Method
- default: false
- parent
- type: Class
- description: The Phase class to attach the new Phase
___
#### Params
- description
- type: String
- description: The description of the new Phase
- options
- type: Object
- description: Some options for the Phase
___
Task Object, called with the correct parameters return #### Params
- name
- type: string
- description: The name of the Task
- exec
- type: Function
- description: This is the Promise Function; the Task will return the result of this Promise Function.
- task
- type: Class
- description: The task to append to
- default: this.task
- phaser
- type: Class
- description: The Phaser which is the parent of the Task
- default: this.phaser
- options
- type: Object
- description: Some options for the new Task
- silent
- type: Boolean
- description: If it is setted as 'true', it will does not show the start or end message in the log
___
#### Examples
``javascript
// All the code to generate the Log
myPhase.start(); // It will start the Phase called 'myPhase'
`Task.error()
___$3
This Method return a Phaser error, which is different by the .start()
After you call the error Method it will stop all the Tasks, it will clear the queue and it will render the error.
If the error is not 'fatal' it will write the error message and continue to other Phase, otherwise it will stop all the Phase.
___$3
This Method expects all tasks in the Phase to be resolved before generating the Log. It is usually called with the Method.
#### Examples
`javascript
// All the code to generate the Log
myPhase.start().waitAllTask(); // It will wait the resolution of all the Tasks
`Writer()
___Phaser()
This Module is used by and Task() to write all the information in the console. It contains the class Writer and some Methods for any type of message you need to print in the console.
#### Params
- generationNumber
- type: 0
- description: It will build a new Writer using the generation index
- default: transporter
- Function
- type: Writer.writer
- description: The writer to use
- default:
___$3
This Method write a formatted message, using Writer transportee options
#### Params
- messageString
- type: options
- description: The message to display
- Object
- type: IWriterOptions
- description: The options transporter for the writer
- default:
___$3
This Method return an header content. If it is the first generation, the header
will be full size and styled, else the writer will build a new header taking a subheader.
#### Params
- contentString
- type: subheader
- description: The name of the Header
- String
- type:
- description: The Subheader to attached to
___$3
This Method return a footer content. If it is the first generation, the footer
will be styled, else the writer will create a new footer.
#### Params
- contentString
- type: description
- description: The content of the footer
- String
- type: color
- description: The description of the footer
___$3
This Method return the log message you want to write in the console.
Below are all the types of Message you can print in the console.
They all requires the String message and an options parameter which, by default, is the writer options Object, it contains and icon params.
- infoFunction
- type: message
- description: This Function return an Info Message in the console.
- String
- type: options
- description: The message you want to write
- Object
- type: IWriterOptions
- description: The color and icon options for the message
- default: success
- Function
- type: message
- description: This Function return a Success Message in the console.
- String
- type: options
- description: The message you want to write
- Object
- type: IWriterOptions
- description: The color and icon options for the message
- default: warning
- Function
- type: message
- description: This Function return a Warning Message in the console.
- String
- type: options
- description: The message you want to write
- Object
- type: IWriterOptions
- description: The color and icon options for the message
- default: error
- Function
- type: message
- description: This Function return an Error Message in the console.
- String
- type: options
- description: The message you want to write
- Object
- type: IWriterOptions
- description: The color and icon options for the message
- default: fatal
- Function
- type: message
- description: This Function return a Fatal Error Message in the console.
- String
- type: options
- description: The message you want to write
- Object
- type: IWriterOptions
- description: The color and icon options for the message
- default: running
- Function
- type: message
- description: This Function return a Running Message in the console.
- String
- type: options
- description: The message you want to write
- Object
- type: IWriterOptions`
- description: The color and icon options for the message
- default: