Skip to content

Commit

Permalink
Merge pull request #224 from sairina/kcontentrenderer
Browse files Browse the repository at this point in the history
Adds props/computed props to mixin for KContentRenderer
  • Loading branch information
rtibbles authored May 19, 2021
2 parents d98a9db + f1538fb commit 3efbcc4
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions lib/content/mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,28 @@ export default {
type: Boolean,
default: false,
},
timeSpent: {
type: Number,
default: 0,
},
duration: {
type: Number,
default: null,
},
},
computed: {
// For when we want to force a renderer to use time-based progress (e.g. instead of % completed)
forceDurationBasedProgress() {
return this.options.force_duration_based_progress || false;
},
// Uses clock-time to track time so that all content types can be tracked the same way
durationBasedProgress() {
const duration = this.duration || this.defaultDuration;
if (!duration) {
return null;
}
return this.timeSpent / duration;
},
defaultItemPreset() {
return this.defaultFile
? this.defaultFile.preset
Expand Down

0 comments on commit 3efbcc4

Please sign in to comment.