Skip to content

Commit 7a79098

Browse files
committed
Monkeypatch p5._report function to resolve file names
1 parent 787b8d4 commit 7a79098

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

client/modules/IDE/reducers/files.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ function draw() {
1212
const defaultHTML = `<!DOCTYPE html>
1313
<html lang="en">
1414
<head>
15-
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.3.1/p5.js"></script>
16-
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.10.2/addons/p5.sound.min.js"></script>
15+
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.4.0/p5.js"></script>
16+
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.4.0/addons/p5.sound.min.js"></script>
1717
<link rel="stylesheet" type="text/css" href="style.css">
1818
<meta charset="utf-8" />
1919

client/utils/previewEntry.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -133,16 +133,16 @@ window.onunhandledrejection = async function onUnhandledRejection(event) {
133133
};
134134

135135
// Monkeypatch p5._friendlyError
136-
// const friendlyError = window.p5._friendlyError;
137-
// window.p5._friendlyError = function (message, method, color) {
138-
// const urls = Object.keys(window.objectUrls);
139-
// const paths = Object.keys(window.objectPaths);
140-
// let newMessage = message;
141-
// urls.forEach((url) => {
142-
// newMessage = newMessage.replaceAll(url, window.objectUrls[url]);
143-
// });
144-
// paths.forEach((path) => {
145-
// newMessage = newMessage.replaceAll(path, window.objectPaths[path]);
146-
// });
147-
// friendlyError.apply(window.p5, [newMessage, method, color]);
148-
// };
136+
const { _report } = window.p5;
137+
window.p5._report = function resolvedReport(message, method, color) {
138+
const urls = Object.keys(window.objectUrls);
139+
const paths = Object.keys(window.objectPaths);
140+
let newMessage = message;
141+
urls.forEach((url) => {
142+
newMessage = newMessage.replaceAll(url, window.objectUrls[url]);
143+
});
144+
paths.forEach((path) => {
145+
newMessage = newMessage.replaceAll(path, window.objectPaths[path]);
146+
});
147+
_report.apply(window.p5, [newMessage, method, color]);
148+
};

0 commit comments

Comments
 (0)