Add test for video bindings

pull/3927/head
Mattias Buelens 5 years ago
parent 004faf67f4
commit f0f5b5aac0

@ -0,0 +1,77 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent,
detach,
element,
init,
insert,
listen,
noop,
raf,
safe_not_equal
} from "svelte/internal";
function create_fragment(ctx) {
let video;
let video_updating = false;
let video_animationframe;
let dispose;
function video_timeupdate_handler() {
cancelAnimationFrame(video_animationframe);
if (!video.paused) {
video_animationframe = raf(video_timeupdate_handler);
video_updating = true;
}
ctx.video_timeupdate_handler.call(video);
}
return {
c() {
video = element("video");
dispose = listen(video, "timeupdate", video_timeupdate_handler);
},
m(target, anchor) {
insert(target, video, anchor);
},
p(changed, ctx) {
if (!video_updating && changed.currentTime && !isNaN(ctx.currentTime)) {
video.currentTime = ctx.currentTime;
}
video_updating = false;
},
i: noop,
o: noop,
d(detaching) {
if (detaching) detach(video);
dispose();
}
};
}
function instance($$self, $$props, $$invalidate) {
let { currentTime } = $$props;
function video_timeupdate_handler() {
currentTime = this.currentTime;
$$invalidate("currentTime", currentTime);
}
$$self.$set = $$props => {
if ("currentTime" in $$props) $$invalidate("currentTime", currentTime = $$props.currentTime);
};
return { currentTime, video_timeupdate_handler };
}
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance, create_fragment, safe_not_equal, { currentTime: 0 });
}
}
export default Component;

@ -0,0 +1,5 @@
<script>
export let currentTime;
</script>
<video bind:currentTime/>
Loading…
Cancel
Save