Displaying in browser
This commit is contained in:
Submodule web/src/cascade updated: fa92c11433...73da6e1c64
@@ -6,7 +6,36 @@
|
||||
<link rel="icon" type="image/png" href="/favicon.png" />
|
||||
<title><%= htmlWebpackPlugin.options.title %></title>
|
||||
<script>
|
||||
var messageHandlers = {}
|
||||
// Install Cascade Studio as a Progressive Web App for Offline Access
|
||||
// This needs to be put before ANY HTTP Requests are made, so it can cache them.
|
||||
var messageHandlers = {};
|
||||
var cascadeStudioWorker
|
||||
var workerWorking = false
|
||||
function coolGuy() {
|
||||
if ('serviceWorker' in navigator) {
|
||||
navigator.serviceWorker.register('service-worker.js').then(function(registration) {
|
||||
registration.update(); // Always update the registration for the latest assets
|
||||
}, function() {
|
||||
console.log('Could not register Cascade Studio for offline use!');
|
||||
});
|
||||
} else {
|
||||
console.log('Browser does not support offline access!');
|
||||
}
|
||||
|
||||
// Begins loading the CAD Kernel Web Worker
|
||||
if (window.Worker) {
|
||||
cascadeStudioWorker = new Worker('./src/cascade/js/CADWorker/CascadeStudioMainWorker.js');
|
||||
// Ping Pong Messages Back and Forth based on their registration in messageHandlers
|
||||
// var messageHandlers = {};
|
||||
cascadeStudioWorker.onmessage = function (e) {
|
||||
if(e.data.type in messageHandlers){
|
||||
let response = messageHandlers[e.data.type](e.data.payload);
|
||||
if (response) { cascadeStudioWorker.postMessage({ "type": e.data.type, payload: response }) };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
coolGuy()
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -6,6 +6,10 @@ import Routes from 'src/Routes'
|
||||
|
||||
import './scaffold.css'
|
||||
import './index.css'
|
||||
import 'golden-layout/src/css/goldenlayout-base.css'
|
||||
import 'golden-layout/src/css/goldenlayout-dark-theme.css'
|
||||
import './cascade/css/main.css'
|
||||
import 'monaco-editor/min/vs/editor/editor.main.css'
|
||||
|
||||
ReactDOM.render(
|
||||
<FatalErrorBoundary page={FatalErrorPage}>
|
||||
|
||||
@@ -1,15 +1,20 @@
|
||||
import BlogLayout from 'src/layouts/BlogLayout'
|
||||
import BlogPostsCell from 'src/components/BlogPostsCell'
|
||||
import { initialize } from 'src/cascade/js/MainPage/CascadeMain'
|
||||
import { useEffect } from 'react'
|
||||
|
||||
|
||||
const HomePage = () => {
|
||||
useEffect(() => {
|
||||
new initialize()
|
||||
// TODO currently you need to press f5 to get the first render to work and for the evaluate menu to show up
|
||||
// figure out why it's not initializing properly
|
||||
}, [])
|
||||
return (
|
||||
|
||||
<BlogLayout>
|
||||
<BlogPostsCell/>
|
||||
<div>
|
||||
<button onClick={() => new initialize()}>init</button>
|
||||
<h1 hidden></h1>
|
||||
<div id="topnav" className="topnav">
|
||||
<a href="https://github.com/zalo/CascadeStudio">Cascade Studio 0.0.6</a>
|
||||
@@ -38,12 +43,6 @@ const HomePage = () => {
|
||||
}}>Reset Project</a>
|
||||
</div>
|
||||
<div id="appbody" style={{height:'auto'}}>
|
||||
{/* <link data-name="vs/editor/editor.main" rel="stylesheet" href="./node_modules/monaco-editor/min/vs/editor/editor.main.css"> */}
|
||||
{/* <script>var require = { paths: { 'vs': 'node_modules/monaco-editor/min/vs' } };</script>
|
||||
<script type="text/javascript" src="./node_modules/monaco-editor/min/vs/loader.js"></script>
|
||||
<script type="text/javascript" src="./node_modules/monaco-editor/min/vs/editor/editor.main.nls.js"></script>
|
||||
<script type="text/javascript" src="./node_modules/monaco-editor/min/vs/editor/editor.main.js"></script>
|
||||
<script type="text/javascript" src="./js/MainPage/CascadeMain.js"></script> */}
|
||||
</div>
|
||||
</div>
|
||||
</BlogLayout>
|
||||
|
||||
Reference in New Issue
Block a user