prevent bindings interfering with each other on the same element #503
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes a bug with audio bindings — when replaying an ended audio track, it should return to the start, but because each of
currentTime
,duration
andpaused
had their own 'lock' variables, state was getting out of sync with the DOM. Fixed by sharing a lock variable between all bindings on the same element.It does mean we have
var audio_updating = false
repeated once per binding. I think the solution to that would be to add ablock.addVariable
method that declares all (or most) variables in a single block at the top — this would also make the code marginally easier to read (in my opinion):