Customization

One of the essential goals of this library is flexibility. You can customize anything as you need. There’re two ways you can do that - globally and per call.

Global way should be used during the library initialization, e.g.:

let notifier = new AWN(options) // where options is an object with your custom values

Defaults will be used, if no options were specified during the initialization.

Per call is applicable, when you need to change something without effect to the global configuration:

notifier.success('Custom message', optionsOverrides) // where optionsOverrides is an object with your custom values

In this case globals will be overriden for current call only.

If you think that some customization opportunity is missing, please open an issue

Options object

In next chapters you can find detailed info about each property of this object.

Key Type Default
position String “bottom-right”
maxNotifications Number 10
animationDuration Number 300
formatError Function see in source code
durations Object See properties below
   durations.global Number,Null 5000
   durations.tip Number,Null null
   durations.info Number,Null null
   durations.success Number,Null null
   durations.warning Number,Null null
   durations.alert Number,Null null
minDurations Object See properties below
   minDurations.async Number 500
   minDurations[“async-block”] Number 500
labels Object See properties below
   labels.tip String “Tip”
   labels.info String “Info”
   labels.success String “Success”
   labels.warning String “Attention”
   labels.alert String “Error”
   labels.async String “Loading”
   labels.confirm String “Confirmation required”
   labels.confirmOk String “OK”
   labels.confirmCancel String “Cancel”
icons Object See properties below
   icons.enabled Boolean true
   icons.prefix String "<i class='fas fa fa-fw fa"
   icons.suffix String "'></i>"
   icons.tip String “question-circle”
   icons.info String “info-circle”
   icons.success String “check-circle”
   icons.warning String “exclamation-circle”
   icons.alert String “exclamation-triangle”
   icons.async String “cof fa-spin”
   icons.confirm String “exclamation-triangle”
messages Object See properties below
   messages.async String “Please, wait…”
   messages[“async-block”] String “Loading”
replacements Object See properties below
   replacements.general Object { "<script>": "", "</script>": "" }
   replacements.tip Object null
   replacements.info Object null
   replacements.success Object null
   replacements.warning Object null
   replacements.alert Object null
   replacements.async Object null
   replacements[“asyncBlock”] Object null
   replacements.modal Object null
   replacements.confirm Object null