mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-11 21:58:31 +00:00
fixed build window issue:
This commit is contained in:
parent
2a2ddf205a
commit
1d95da7a3a
@ -39,6 +39,8 @@ function safeEval(str, options = {}) {
|
||||
|
||||
export const evaluate = async (code, transpiler, transpilerOptions) => {
|
||||
let meta = {};
|
||||
//post to iframe parent (like Udels) if it exists...
|
||||
window.parent?.postMessage(code);
|
||||
if (transpiler) {
|
||||
// transform syntactically correct js code to semantically usable code
|
||||
const transpiled = transpiler(code, transpilerOptions);
|
||||
|
||||
@ -2,9 +2,7 @@ import { useRef } from 'react';
|
||||
|
||||
export function UdelFrame({ onEvaluate, hash, instance }) {
|
||||
const ref = useRef();
|
||||
console.info('frame')
|
||||
window.addEventListener('message', (message) => {
|
||||
console.info(message, 'message')
|
||||
const childWindow = ref?.current?.contentWindow;
|
||||
if (message == null || message.source !== childWindow) {
|
||||
return; // Skip message in this event listener
|
||||
|
||||
@ -29,9 +29,13 @@ export const defaultSettings = {
|
||||
userPatterns: '{}',
|
||||
audioDeviceName: defaultAudioDeviceName,
|
||||
};
|
||||
const search = new URLSearchParams(window.location.search);
|
||||
|
||||
let search = null;
|
||||
if (typeof window !== 'undefined') {
|
||||
search = new URLSearchParams(window.location.search);
|
||||
}
|
||||
// if running multiple instance in one window, it will use the settings for that instance. else default to normal
|
||||
const instance = parseInt(search.get('instance') ?? '0');
|
||||
const instance = parseInt(search?.get('instance') ?? '0');
|
||||
const settings_key = `strudel-settings${instance > 0 ? instance : ''}`;
|
||||
|
||||
export const settingsMap = persistentMap(settings_key, defaultSettings);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user