Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds props/computed props to mixin for KContentRenderer #224

Merged
merged 6 commits into from
May 19, 2021
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
forceTimeBasedProgress() {
sairina marked this conversation as resolved.
Show resolved Hide resolved
return this.options.force_time_based_progress || false;
sairina marked this conversation as resolved.
Show resolved Hide resolved
},
// 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