-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7001 from davidwatkins73/master
Waltz Svelte Component now cascades destroy events from ng to svelte
- Loading branch information
Showing
8 changed files
with
140 additions
and
248 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<script> | ||
import {onDestroy, onMount} from "svelte"; | ||
onMount(() => console.log("child onMount")); | ||
onDestroy(() => console.log("child onDestroy")); | ||
</script> | ||
|
||
<h1> | ||
Hello child | ||
</h1> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<script> | ||
import {onDestroy, onMount} from "svelte"; | ||
import Child from "./Child.svelte"; | ||
onMount(() => console.log("parent onMount")); | ||
onDestroy(() => console.log("parent onDestroy")); | ||
let show = true; | ||
export let counter = 0; | ||
$: d = counter * counter; | ||
</script> | ||
|
||
<h1>Hello Parent: counter is {counter}, sq: {d}</h1> | ||
|
||
|
||
<button on:click={() => show = !show}>Toggle Child</button> | ||
|
||
{#if show} | ||
<Child/> | ||
{/if} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<script> | ||
import {onDestroy, onMount} from "svelte"; | ||
export let counter = 0; | ||
onMount(() => console.log("unaware onMount")); | ||
onDestroy(() => console.log("unaware onDestroy")); | ||
</script> | ||
|
||
<h1>Hello Unaware: counter is {counter}</h1> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import _ from "lodash"; | ||
import {isRemoved} from "../../common/entity-utils"; | ||
import {initialiseData} from "../../common"; | ||
import {columnDef, withWidth} from "../../physical-flow/physical-flow-table-utilities"; | ||
import template from "../../physical-specifications/components/physical-data-section/physical-data-section.html"; | ||
|
||
const bindings = { | ||
|
||
}; | ||
|
||
|
||
const initialState = { | ||
|
||
}; | ||
|
||
|
||
function controller() { | ||
|
||
const vm = initialiseData(this, initialState); | ||
|
||
vm.$onInit = () => { | ||
console.log("lifecycle onInit"); | ||
} | ||
vm.$onDestroy = () => { | ||
console.log("lifecycle onDestroy"); | ||
} | ||
} | ||
|
||
controller.$inject = ["$scope"]; | ||
|
||
|
||
const component = { | ||
template, | ||
bindings, | ||
controller | ||
}; | ||
|
||
|
||
export default component; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.