change the way I propagate actions
This commit is contained in:
parent
1dd6be4b1a
commit
a9e1c4e50a
@ -43,6 +43,8 @@
|
|||||||
|
|
||||||
const set_screens = ({detail}) => ship.dispatch.set_screens(detail);
|
const set_screens = ({detail}) => ship.dispatch.set_screens(detail);
|
||||||
|
|
||||||
|
const ship_dispatch = ({detail}) => ship.dispatch(detail);
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
@ -82,7 +84,7 @@
|
|||||||
</Section>
|
</Section>
|
||||||
|
|
||||||
<Section label="misc">
|
<Section label="misc">
|
||||||
<Cargo {...$ship.cargo} />
|
<Cargo {...$ship.cargo} on:set_cargo={ship_dispatch}/>
|
||||||
</Section>
|
</Section>
|
||||||
|
|
||||||
</main>
|
</main>
|
||||||
|
@ -8,17 +8,18 @@
|
|||||||
import get from 'lodash/get';
|
import get from 'lodash/get';
|
||||||
import ShipItem from '~C/ShipItem/index.svelte';
|
import ShipItem from '~C/ShipItem/index.svelte';
|
||||||
import Field from '~C/Field/index.svelte';
|
import Field from '~C/Field/index.svelte';
|
||||||
|
import dux from '~/dux/cargo';
|
||||||
|
|
||||||
import {getContext} from 'svelte';
|
import {getContext, createEventDispatcher} from 'svelte';
|
||||||
|
|
||||||
const ship = getContext('ship');
|
const ship = getContext('ship');
|
||||||
|
|
||||||
export let space = 0;
|
export let space = 0;
|
||||||
export let cost = 0;
|
export let cost = 0;
|
||||||
export let mass = 0;
|
export let mass = 0;
|
||||||
export let set_cargo = get(ship,'dispatch.set_cargo',() => {});
|
|
||||||
|
|
||||||
$: set_cargo( space );
|
const dispatch = createEventDispatcher();
|
||||||
|
$: dispatch( 'set_cargo', dux.actions.set_cargo( space ) );
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user