Merge pull request from sveltejs/actions-onmount

Change actions to init on mount rather than hydrate
pull/1677/head
Rich Harris 7 years ago committed by GitHub
commit 7242905e9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -846,7 +846,7 @@ export default class Element extends Node {
block.addVariable(name);
const fn = `%actions-${action.name}`;
block.builders.hydrate.addLine(
block.builders.mount.addLine(
`${name} = ${fn}.call(#component, ${this.var}${snippet ? `, ${snippet}` : ''}) || {};`
);

@ -133,7 +133,7 @@ var proto = {
/* generated by Svelte vX.Y.Z */
function link(node) {
function onClick(event) {
event.preventDefault();
history.pushState(null, null, event.target.href);
@ -155,11 +155,11 @@ function create_main_fragment(component, ctx) {
a = createElement("a");
a.textContent = "Test";
a.href = "#";
link_action = link.call(component, a) || {};
},
m(target, anchor) {
insert(target, a, anchor);
link_action = link.call(component, a) || {};
},
p: noop,

@ -2,7 +2,7 @@
import { assign, createElement, detachNode, init, insert, noop, proto } from "svelte/shared.js";
function link(node) {
function onClick(event) {
event.preventDefault();
history.pushState(null, null, event.target.href);
@ -25,11 +25,11 @@ function create_main_fragment(component, ctx) {
a = createElement("a");
a.textContent = "Test";
a.href = "#";
link_action = link.call(component, a) || {};
},
m(target, anchor) {
insert(target, a, anchor);
link_action = link.call(component, a) || {};
},
p: noop,

Loading…
Cancel
Save