-
Notifications
You must be signed in to change notification settings - Fork 249
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
issue/1523: added xapi model state functions #1524
Conversation
src/core/js/models/componentModel.js
Outdated
}, | ||
|
||
triggerState: function() { | ||
Adapt.tirgger("state:change", this.getState()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo tirgger
...
result = []; | ||
break; | ||
case "object": | ||
retuls = {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo.
result = []; | ||
break; | ||
case "object": | ||
retuls = {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup
// Unset waiting flag | ||
this.triggerTrackableState.isQueued = false; | ||
|
||
}, this), 17) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 17 here is a magic number. Also, why 17?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
60fps ish. anywhere between 17ms and 40ms is usually good for stuff like this (25-60fps).
a defer would probably suffice but i wanted to group as many model changes as i could into one trigger, these numbers allow for a few short asynchronous model changes to occur before a callback without it seeming too laggy. > 250ms is probably too laggy (4 fps)
src/core/js/models/adaptModel.js
Outdated
var trackable = _.result(this, 'trackable', []); | ||
if (!_.keys(model.changed).find(function(item, index) { | ||
return _.contains(trackable, item); | ||
})) return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is quite difficult to read. Could we change to something like:
var isTrackable = _.keys(model.changed).find(function(item, index) {
return _.contains(_.result(this, 'trackable', []), item);
}.bind(this));
if (isTrackable) {
this.triggerTrackableState();
}
❓
src/core/js/models/adaptModel.js
Outdated
|
||
// Skip if trigger queued or adapt hasn't started yet | ||
if (this.triggerTrackableState.isQueued || !Adapt.attributes._isStarted) { | ||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semi-colon.
as per #1523