pull/4156/head
Conduitry 6 years ago
parent b433440533
commit 218d23782c

@ -29,7 +29,7 @@ export function add_action(block: Block, target: string, action: Action) {
const fn = block.renderer.reference(action.name); const fn = block.renderer.reference(action.name);
block.event_listeners.push( block.event_listeners.push(
x`@destroy_action(${id} = ${fn}.call(null, ${target}, ${snippet}))` x`@action_destroyer(${id} = ${fn}.call(null, ${target}, ${snippet}))`
); );
if (dependencies && dependencies.length > 0) { if (dependencies && dependencies.length > 0) {

@ -122,10 +122,6 @@ export function set_store_value(store, ret, value = ret) {
export const has_prop = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop); export const has_prop = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
export function destroy_action(action_result) { export function action_destroyer(action_result) {
return () => { return action_result && is_function(action_result.destroy) ? action_result.destroy : noop;
if (action_result && is_function(action_result.destroy)) {
return action_result.destroy();
}
};
} }

@ -1,7 +1,7 @@
/* generated by Svelte vX.Y.Z */ /* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
destroy_action, action_destroyer,
detach, detach,
element, element,
init, init,
@ -20,7 +20,7 @@ function create_fragment(ctx) {
c() { c() {
button = element("button"); button = element("button");
button.textContent = "foo"; button.textContent = "foo";
dispose = destroy_action(foo_action = foo.call(null, button, /*foo_function*/ ctx[1])); dispose = action_destroyer(foo_action = foo.call(null, button, /*foo_function*/ ctx[1]));
}, },
m(target, anchor) { m(target, anchor) {
insert(target, button, anchor); insert(target, button, anchor);
@ -42,7 +42,7 @@ function handleFoo(bar) {
} }
function foo(node, callback) { function foo(node, callback) {
} }
function instance($$self, $$props, $$invalidate) { function instance($$self, $$props, $$invalidate) {

@ -1,8 +1,8 @@
/* generated by Svelte vX.Y.Z */ /* generated by Svelte vX.Y.Z */
import { import {
SvelteComponent, SvelteComponent,
action_destroyer,
attr, attr,
destroy_action,
detach, detach,
element, element,
init, init,
@ -21,7 +21,7 @@ function create_fragment(ctx) {
a = element("a"); a = element("a");
a.textContent = "Test"; a.textContent = "Test";
attr(a, "href", "#"); attr(a, "href", "#");
dispose = destroy_action(link_action = link.call(null, a)); dispose = action_destroyer(link_action = link.call(null, a));
}, },
m(target, anchor) { m(target, anchor) {
insert(target, a, anchor); insert(target, a, anchor);

Loading…
Cancel
Save