diff options
-rw-r--r-- | kvision-modules/kvision-pace/src/main/kotlin/pl/treksoft/kvision/pace/Pace.kt | 95 |
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() + } } } |