Skip to content

Commit

Permalink
Merge pull request #94 from milafrerichs/fix/update-files
Browse files Browse the repository at this point in the history
Fix/update files
  • Loading branch information
milafrerichs authored Jan 3, 2020
2 parents 16d0154 + 3136111 commit 02b7de3
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 4 deletions.
6 changes: 6 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# v0.6.1
## Fixed
- Resetting of the code now works again
- destroying of the component resulted in an error
- add width of viewer/console layout back in

# v0.6.0
## Changed
Internal changes to how the iframes work and how messages are posted, should improve performance and future use
Expand Down
15 changes: 15 additions & 0 deletions example/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,24 @@
function changeLayout() {
layout = (layout === 'default' ? 'view' : 'default');
}
function resetFiles() {
files = [
{
name: 'index.html',
content: '<h1>Test</h1>',
type: 'html'
},
{
name: 'index.js',
content: '',
type: 'js'
}
];
}
</script>

<a href="javascript:;" on:click={changeLayout}>Change Layout</a>
<a href="javascript:;" on:click={resetFiles}>Reset</a>
<Repl {layout} {files} />

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "javascript-repl",
"svelte": "src/Repl.svelte",
"module": "index.mjs",
"version": "0.6.0",
"version": "0.6.1",
"description": "",
"main": "index.js",
"author": "Mila Frerichs <[email protected]>",
Expand Down
6 changes: 5 additions & 1 deletion src/Repl.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,15 @@
});
function handleSelect() {
editor.set($currentContent);
if(editor) {
editor.set($currentContent);
}
}
$: if(files) {
bundle.set({});
file_store.set(files);
handleSelect();
}
$: if(injectedJS) {
injectedJS_store.set(injectedJS);
Expand Down
1 change: 0 additions & 1 deletion src/Result.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@
}
});
onDestroy(() => {
iframeReady.setReady(false, name)
iframe.removeEventListener('load', setReady);
});
Expand Down
2 changes: 1 addition & 1 deletion src/ViewerConsole.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</div>
<div class="{cssStyles.viewerConsoleContainer}" bind:clientWidth={iframeComtainerWidth} bind:clientHeight={iframeComtainerHeight} >
<div class:hidden="{tab != 'viewer'}" class="{cssStyles.viewer}" >
<Viewer width={iframeComtainerWidth} />
<Viewer width={iframeComtainerWidth} height={iframeComtainerHeight} />
</div>
<div class:hidden="{tab != 'console'}" class="{cssStyles.console}" >
<Console width={iframeComtainerWidth} height={iframeComtainerHeight} />
Expand Down
1 change: 1 addition & 0 deletions src/stores.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const createBundle = () => {

return {
subscribe,
set,
changeCode: (file, code) => {
return update((n) => {
n[file.name] = code;
Expand Down

0 comments on commit 02b7de3

Please sign in to comment.