aboutsummaryrefslogtreecommitdiff
path: root/kvision-modules
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2019-10-20 00:00:11 +0200
committerRobert Jaros <rjaros@finn.pl>2019-10-20 00:00:11 +0200
commita48be746f3bcfce57761f88cc009b5df802ed8cd (patch)
tree2f9428b9be9647b2afb77e62a0edcd924b450a1c /kvision-modules
parent09d87962cf4b025431a0647fe889504b621292fd (diff)
downloadkvision-a48be746f3bcfce57761f88cc009b5df802ed8cd.tar.gz
kvision-a48be746f3bcfce57761f88cc009b5df802ed8cd.tar.bz2
kvision-a48be746f3bcfce57761f88cc009b5df802ed8cd.zip
Support manual mode in Pace module.
Diffstat (limited to 'kvision-modules')
-rw-r--r--kvision-modules/kvision-pace/src/main/kotlin/pl/treksoft/kvision/pace/Pace.kt95
1 files changed, 56 insertions, 39 deletions
diff --git a/kvision-modules/kvision-pace/src/main/kotlin/pl/treksoft/kvision/pace/Pace.kt b/kvision-modules/kvision-pace/src/main/kotlin/pl/treksoft/kvision/pace/Pace.kt
index 77ae00cf..8905ce2c 100644
--- a/kvision-modules/kvision-pace/src/main/kotlin/pl/treksoft/kvision/pace/Pace.kt
+++ b/kvision-modules/kvision-pace/src/main/kotlin/pl/treksoft/kvision/pace/Pace.kt
@@ -92,47 +92,56 @@ class PaceOptions(
restartOnPushState: Boolean? = null,
restartOnRequestAfter: Double? = null,
startOnPageLoad: Boolean? = null,
- target: String? = null
+ target: String? = null,
+ manual: Boolean = false
) {
internal var paceOptionsJs: dynamic = obj {
- if (ajax != null) {
- this.ajax = ajax.paceAjaxOptionsJs
- }
- if (catchupTime != null) {
- this.catchupTime = catchupTime
- }
- if (easeFactor != null) {
- this.easeFactor = easeFactor
- }
- if (elements != null) {
- this.elements = elements.paceElementsOptionsJs
- }
- if (eventLag != null) {
- this.eventLag = eventLag.paceEventLagOptionsJs
- }
- if (ghostTime != null) {
- this.ghostTime = ghostTime
- }
- if (initialRate != null) {
- this.initialRate = initialRate
- }
- if (maxProgressPerFrame != null) {
- this.maxProgressPerFrame = maxProgressPerFrame
- }
- if (minTime != null) {
- this.minTime = minTime
- }
- if (restartOnPushState != null) {
- this.restartOnPushState = restartOnPushState
- }
- if (restartOnRequestAfter != null) {
- this.restartOnRequestAfter = restartOnRequestAfter
- }
- if (startOnPageLoad != null) {
- this.startOnPageLoad = startOnPageLoad
- }
- if (target != null) {
- this.target = target
+ if (!manual) {
+ if (ajax != null) {
+ this.ajax = ajax.paceAjaxOptionsJs
+ }
+ if (catchupTime != null) {
+ this.catchupTime = catchupTime
+ }
+ if (easeFactor != null) {
+ this.easeFactor = easeFactor
+ }
+ if (elements != null) {
+ this.elements = elements.paceElementsOptionsJs
+ }
+ if (eventLag != null) {
+ this.eventLag = eventLag.paceEventLagOptionsJs
+ }
+ if (ghostTime != null) {
+ this.ghostTime = ghostTime
+ }
+ if (initialRate != null) {
+ this.initialRate = initialRate
+ }
+ if (maxProgressPerFrame != null) {
+ this.maxProgressPerFrame = maxProgressPerFrame
+ }
+ if (minTime != null) {
+ this.minTime = minTime
+ }
+ if (restartOnPushState != null) {
+ this.restartOnPushState = restartOnPushState
+ }
+ if (restartOnRequestAfter != null) {
+ this.restartOnRequestAfter = restartOnRequestAfter
+ }
+ if (startOnPageLoad != null) {
+ this.startOnPageLoad = startOnPageLoad
+ }
+ if (target != null) {
+ this.target = target
+ }
+ } else {
+ this.ajax = false
+ this.elements = false
+ this.document = false
+ this.eventLag = false
+ this.startOnPageLoad = false
}
}
}
@@ -157,5 +166,13 @@ class Pace {
fun stop() {
window["Pace"].stop()
}
+
+ fun show() {
+ window["Pace"].bar.render()
+ }
+
+ fun hide() {
+ window["Pace"].stop()
+ }
}
}