forked from vividvilla/ezhil
-
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
9 changed files
with
97 additions
and
0 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,27 @@ | ||
// // Note: We're using the CDN in "production". | ||
// import * as React from 'react' | ||
// import * as ReactDOM from 'react-dom'; | ||
|
||
// // A simple React JSX component. | ||
// class LikeButton extends React.Component { | ||
// constructor(props) { | ||
// super(props); | ||
// this.state = { liked: false }; | ||
// } | ||
|
||
// render() { | ||
// if (this.state.liked) { | ||
// return 'You liked this!'; | ||
// } | ||
|
||
// return ( | ||
// <button onClick={() => this.setState({ liked: true }) }> | ||
// Like | ||
// </button> | ||
// ); | ||
// } | ||
// } | ||
|
||
|
||
// const domContainer = document.querySelector('#like_button_container'); | ||
// ReactDOM.render(<LikeButton />, domContainer); |
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,38 @@ | ||
//// From mod1, but hello1 get its data from mod2. | ||
import { hello1, hello2 } from 'core/util'; | ||
// From mod2 | ||
import * as data from 'core/util/data.json'; | ||
// hello3, hello6 lives in mod2 which also have a index.js in util. | ||
// But doing import from 'core/util' you will get the index.js file from mod1 | ||
// (higher up in the import list), so we need to be explicit: | ||
import { hello3, hello6 } from 'core/util/hello3'; | ||
|
||
// From main | ||
import { hello4 } from './lib'; | ||
// From the Hugo template. | ||
import * as params from '@params'; | ||
|
||
var worker = new Worker(params.myworker); | ||
|
||
worker.addEventListener( | ||
'message', | ||
function(e) { | ||
console.log('Worker said: ', e.data); | ||
}, | ||
false | ||
); | ||
|
||
worker.postMessage('Hello Worker'); | ||
|
||
// https://github.com/gohugoio/hugo/issues/7948 | ||
// TODO(bep) make this work in Hugo integration tests import { helloNodeModules } from 'mynodemod'; | ||
|
||
window.hello1 = hello1; | ||
window.hello2 = hello2; | ||
window.hello3 = hello3; | ||
window.hello4 = hello4; | ||
window.hello6 = hello6; | ||
window.cwd = process.cwd; // Shim injected | ||
// TODO(bep) make this work in Hugo integration tests window.helloNodeModules = helloNodeModules; | ||
window.data = data; | ||
window.params = params; |
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,7 @@ | ||
self.addEventListener( | ||
'message', | ||
function(e) { | ||
self.postMessage('Echo From Worker: ' + e.data); | ||
}, | ||
false | ||
); |
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,14 @@ | ||
function Example() { | ||
const [count, setCount] = React.useState(0); | ||
|
||
return ( | ||
<div> | ||
<p>You clicked {count} times</p> | ||
<button onClick={() => setCount(count + 1)}> | ||
Click me | ||
</button> | ||
</div> | ||
); | ||
} | ||
ReactDOM.render(React.createElement(Example), | ||
document.getElementById("app")); |
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,3 @@ | ||
export let process = { | ||
cwd: () => 'shim cwd' | ||
}; |
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 @@ | ||
module.exports = window.ReactDOM; |
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 @@ | ||
module.exports = window.React; |
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,3 @@ | ||
import * as React from 'react' | ||
import * as ReactDOM from 'react-dom'; | ||
|
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,3 @@ | ||
export function hello4() { | ||
return 'Hello from lib in the main project!!'; | ||
} |