-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
1,829 additions
and
89 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,9 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<body> | ||
<h1>Child Frame</h1> | ||
|
||
<button>Increment counter</button> | ||
<script type="module" src="/child.js"></script> | ||
</body> | ||
</html> |
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 @@ | ||
const { ChildFrame } = require("../../build/index"); | ||
|
||
|
||
|
||
(function() { | ||
const frameEvents = new ChildFrame(); | ||
|
||
document.querySelector("button").addEventListener("click", function () { | ||
frameEvents.run.updateCounter(); | ||
}); | ||
})(); |
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,13 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<body> | ||
|
||
<h1>Parent Frame</h1> | ||
<p>Counter: <span id="counter">0</span></p> | ||
|
||
<iframe id="childFrame" src="./ChildFrame.html?_origin=localhost:3030&_placement=TEST" width="500" height="500"></iframe> | ||
|
||
<script type="text/javascript" src="/parent.js"></script> | ||
|
||
</body> | ||
</html> |
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,31 @@ | ||
/* eslint-disable */ | ||
|
||
const { ParentFrame } = require("../../build/index"); | ||
|
||
(function() { | ||
const state = { | ||
counter: 0, | ||
}; | ||
|
||
console.log('test') | ||
const element = document.getElementById("childFrame"); | ||
console.log(element) | ||
|
||
new ParentFrame({ | ||
child: document.getElementById("childFrame"), | ||
methods: { | ||
updateCounter: function () { | ||
state.counter = state.counter++; | ||
this.send("counterUpdated", { | ||
counter: state.counter, | ||
}); | ||
|
||
const counterElement = document.getElementById("counter"); | ||
counterElement.innerHTML = state.counter; | ||
console.log('!!!') | ||
}, | ||
}, | ||
listeners: ["counterUpdated"], | ||
scripts: [], | ||
}); | ||
})(); |
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,22 @@ | ||
/* eslint-disable */ | ||
|
||
const path = require('path'); | ||
|
||
module.exports = { | ||
entry: { | ||
parent: path.resolve(__dirname, './assets/parent.js'), | ||
child: path.resolve(__dirname, './assets/child.js'), | ||
}, | ||
output: { | ||
filename: '[name].js', | ||
path: path.resolve(__dirname, 'assets/build'), | ||
}, | ||
mode: 'production', | ||
target: "web", | ||
devServer: { | ||
static: { | ||
directory: path.join(__dirname, 'assets'), | ||
}, | ||
port: 3030, | ||
}, | ||
}; |
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.