How to use the svelte/internal.listen function in svelte

To help you get started, we’ve selected a few svelte examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sveltejs / svelte / test / js / samples / media-bindings / expected.js View on Github external
if (/*played*/ ctx[2] === void 0 || /*currentTime*/ ctx[3] === void 0 || /*ended*/ ctx[9] === void 0) add_render_callback(audio_timeupdate_handler);
			if (/*duration*/ ctx[4] === void 0) add_render_callback(() => /*audio_durationchange_handler*/ ctx[13].call(audio));
			if (/*seeking*/ ctx[8] === void 0) add_render_callback(() => /*audio_seeking_seeked_handler*/ ctx[17].call(audio));
			if (/*ended*/ ctx[9] === void 0) add_render_callback(() => /*audio_ended_handler*/ ctx[18].call(audio));

			dispose = [
				listen(audio, "progress", /*audio_progress_handler*/ ctx[10]),
				listen(audio, "loadedmetadata", /*audio_loadedmetadata_handler*/ ctx[11]),
				listen(audio, "timeupdate", audio_timeupdate_handler),
				listen(audio, "durationchange", /*audio_durationchange_handler*/ ctx[13]),
				listen(audio, "play", /*audio_play_pause_handler*/ ctx[14]),
				listen(audio, "pause", /*audio_play_pause_handler*/ ctx[14]),
				listen(audio, "volumechange", /*audio_volumechange_handler*/ ctx[15]),
				listen(audio, "ratechange", /*audio_ratechange_handler*/ ctx[16]),
				listen(audio, "seeking", /*audio_seeking_seeked_handler*/ ctx[17]),
				listen(audio, "seeked", /*audio_seeking_seeked_handler*/ ctx[17]),
				listen(audio, "ended", /*audio_ended_handler*/ ctx[18])
			];
		},
		m(target, anchor) {
github sveltejs / svelte / test / js / samples / event-handler-dynamic / expected.js View on Github external
p0 = element("p");
			button0 = element("button");
			button0.textContent = "set handler 1";
			t1 = space();
			button1 = element("button");
			button1.textContent = "set handler 2";
			t3 = space();
			p1 = element("p");
			t4 = text(/*number*/ ctx[1]);
			t5 = space();
			button2 = element("button");
			button2.textContent = "click";

			dispose = [
				listen(button0, "click", /*updateHandler1*/ ctx[2]),
				listen(button1, "click", /*updateHandler2*/ ctx[3]),
				listen(button2, "click", function () {
					if (is_function(/*clickHandler*/ ctx[0])) /*clickHandler*/ ctx[0].apply(this, arguments);
				})
			];
		},
		m(target, anchor) {
github sveltejs / svelte / test / js / samples / window-binding-scroll / expected.js View on Github external
c() {
			p = element("p");
			t0 = text("scrolled to ");
			t1 = text(ctx[0]);

			dispose = listen(window, "scroll", () => {
				scrolling = true;
				clearTimeout(scrolling_timeout);
				scrolling_timeout = setTimeout(clear_scrolling, 100);
				ctx[1]();
			});
		},
		m(target, anchor) {
github sveltejs / svelte / test / js / samples / media-bindings / expected.js View on Github external
if (/*buffered*/ ctx[0] === void 0) add_render_callback(() => /*audio_progress_handler*/ ctx[10].call(audio));
			if (/*buffered*/ ctx[0] === void 0 || /*seekable*/ ctx[1] === void 0) add_render_callback(() => /*audio_loadedmetadata_handler*/ ctx[11].call(audio));
			if (/*played*/ ctx[2] === void 0 || /*currentTime*/ ctx[3] === void 0 || /*ended*/ ctx[9] === void 0) add_render_callback(audio_timeupdate_handler);
			if (/*duration*/ ctx[4] === void 0) add_render_callback(() => /*audio_durationchange_handler*/ ctx[13].call(audio));
			if (/*seeking*/ ctx[8] === void 0) add_render_callback(() => /*audio_seeking_seeked_handler*/ ctx[17].call(audio));
			if (/*ended*/ ctx[9] === void 0) add_render_callback(() => /*audio_ended_handler*/ ctx[18].call(audio));

			dispose = [
				listen(audio, "progress", /*audio_progress_handler*/ ctx[10]),
				listen(audio, "loadedmetadata", /*audio_loadedmetadata_handler*/ ctx[11]),
				listen(audio, "timeupdate", audio_timeupdate_handler),
				listen(audio, "durationchange", /*audio_durationchange_handler*/ ctx[13]),
				listen(audio, "play", /*audio_play_pause_handler*/ ctx[14]),
				listen(audio, "pause", /*audio_play_pause_handler*/ ctx[14]),
				listen(audio, "volumechange", /*audio_volumechange_handler*/ ctx[15]),
				listen(audio, "ratechange", /*audio_ratechange_handler*/ ctx[16]),
				listen(audio, "seeking", /*audio_seeking_seeked_handler*/ ctx[17]),
				listen(audio, "seeked", /*audio_seeking_seeked_handler*/ ctx[17]),
				listen(audio, "ended", /*audio_ended_handler*/ ctx[18])
			];
		},
		m(target, anchor) {
github sveltejs / svelte / test / js / samples / video-bindings / expected.js View on Github external
c() {
			video = element("video");
			if (/*videoHeight*/ ctx[1] === void 0 || /*videoWidth*/ ctx[2] === void 0) add_render_callback(() => /*video_resize_handler*/ ctx[5].call(video));
			add_render_callback(() => /*video_elementresize_handler*/ ctx[6].call(video));

			dispose = [
				listen(video, "timeupdate", video_timeupdate_handler),
				listen(video, "resize", /*video_resize_handler*/ ctx[5])
			];
		},
		m(target, anchor) {
github sveltejs / svelte / test / js / samples / input-without-blowback-guard / expected.js View on Github external
c() {
			input = element("input");
			attr(input, "type", "checkbox");
			dispose = listen(input, "change", ctx[1]);
		},
		m(target, anchor) {
github sveltejs / svelte / test / js / samples / input-no-initial-value / expected.js View on Github external
c() {
			form = element("form");
			input = element("input");
			t0 = space();
			button = element("button");
			button.textContent = "Store";
			attr(input, "type", "text");
			input.required = true;

			dispose = [
				listen(input, "input", /*input_input_handler*/ ctx[2]),
				listen(form, "submit", /*handleSubmit*/ ctx[1])
			];
		},
		m(target, anchor) {
github sveltejs / svelte / test / js / samples / bind-online / expected.js View on Github external
c() {
			dispose = [
				listen(window, "online", /*onlinestatuschanged*/ ctx[1]),
				listen(window, "offline", /*onlinestatuschanged*/ ctx[1])
			];
		},
		m: noop,
github sveltejs / svelte / test / js / samples / event-handler-dynamic / expected.js View on Github external
c() {
			p0 = element("p");
			button0 = element("button");
			button0.textContent = "set handler 1";
			t1 = space();
			button1 = element("button");
			button1.textContent = "set handler 2";
			t3 = space();
			p1 = element("p");
			t4 = text(/*number*/ ctx[1]);
			t5 = space();
			button2 = element("button");
			button2.textContent = "click";

			dispose = [
				listen(button0, "click", /*updateHandler1*/ ctx[2]),
				listen(button1, "click", /*updateHandler2*/ ctx[3]),
				listen(button2, "click", function () {
					if (is_function(/*clickHandler*/ ctx[0])) /*clickHandler*/ ctx[0].apply(this, arguments);
				})
			];
		},
		m(target, anchor) {
github sveltejs / svelte / test / js / samples / media-bindings / expected.js View on Github external
audio = element("audio");
			if (/*buffered*/ ctx[0] === void 0) add_render_callback(() => /*audio_progress_handler*/ ctx[10].call(audio));
			if (/*buffered*/ ctx[0] === void 0 || /*seekable*/ ctx[1] === void 0) add_render_callback(() => /*audio_loadedmetadata_handler*/ ctx[11].call(audio));
			if (/*played*/ ctx[2] === void 0 || /*currentTime*/ ctx[3] === void 0 || /*ended*/ ctx[9] === void 0) add_render_callback(audio_timeupdate_handler);
			if (/*duration*/ ctx[4] === void 0) add_render_callback(() => /*audio_durationchange_handler*/ ctx[13].call(audio));
			if (/*seeking*/ ctx[8] === void 0) add_render_callback(() => /*audio_seeking_seeked_handler*/ ctx[17].call(audio));
			if (/*ended*/ ctx[9] === void 0) add_render_callback(() => /*audio_ended_handler*/ ctx[18].call(audio));

			dispose = [
				listen(audio, "progress", /*audio_progress_handler*/ ctx[10]),
				listen(audio, "loadedmetadata", /*audio_loadedmetadata_handler*/ ctx[11]),
				listen(audio, "timeupdate", audio_timeupdate_handler),
				listen(audio, "durationchange", /*audio_durationchange_handler*/ ctx[13]),
				listen(audio, "play", /*audio_play_pause_handler*/ ctx[14]),
				listen(audio, "pause", /*audio_play_pause_handler*/ ctx[14]),
				listen(audio, "volumechange", /*audio_volumechange_handler*/ ctx[15]),
				listen(audio, "ratechange", /*audio_ratechange_handler*/ ctx[16]),
				listen(audio, "seeking", /*audio_seeking_seeked_handler*/ ctx[17]),
				listen(audio, "seeked", /*audio_seeking_seeked_handler*/ ctx[17]),
				listen(audio, "ended", /*audio_ended_handler*/ ctx[18])
			];
		},
		m(target, anchor) {