export strudelScope for mondo to use
This commit is contained in:
parent
e3df504423
commit
e782dc09dd
1 changed files with 3 additions and 0 deletions
|
|
@ -4,6 +4,8 @@ Copyright (C) 2022 Strudel contributors - see <https://github.com/tidalcycles/st
|
||||||
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
export const strudelScope = {};
|
||||||
|
|
||||||
export const evalScope = async (...args) => {
|
export const evalScope = async (...args) => {
|
||||||
const results = await Promise.allSettled(args);
|
const results = await Promise.allSettled(args);
|
||||||
const modules = results.filter((result) => result.status === 'fulfilled').map((r) => r.value);
|
const modules = results.filter((result) => result.status === 'fulfilled').map((r) => r.value);
|
||||||
|
|
@ -18,6 +20,7 @@ export const evalScope = async (...args) => {
|
||||||
modules.forEach((module) => {
|
modules.forEach((module) => {
|
||||||
Object.entries(module).forEach(([name, value]) => {
|
Object.entries(module).forEach(([name, value]) => {
|
||||||
globalThis[name] = value;
|
globalThis[name] = value;
|
||||||
|
strudelScope[name] = value;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
return modules;
|
return modules;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue