mirror of
https://github.com/storybookjs/storybook.git
synced 2025-03-31 05:03:21 +08:00
Fix IE11 compatibility by avoiding ES6 syntax and using XHR instead of fetch.
This commit is contained in:
parent
0e56733636
commit
4112b32080
@ -27,11 +27,20 @@
|
||||
window.onerror = function onerror(message, source, line, column, err) {
|
||||
if (window.CONFIG_TYPE !== 'DEVELOPMENT') return;
|
||||
// eslint-disable-next-line no-var, vars-on-top
|
||||
var error = { message: err.message, name: err.name, stack: err.stack };
|
||||
window.fetch('/runtime-error', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ message, source, line, column, error, origin: 'manager' }),
|
||||
});
|
||||
var xhr = new window.XMLHttpRequest();
|
||||
xhr.open('POST', '/runtime-error');
|
||||
xhr.setRequestHeader('Content-Type', 'application/json;charset=UTF-8');
|
||||
xhr.send(
|
||||
JSON.stringify({
|
||||
/* eslint-disable object-shorthand */
|
||||
message: message,
|
||||
source: source,
|
||||
line: line,
|
||||
column: column,
|
||||
error: { message: err.message, name: err.name, stack: err.stack },
|
||||
origin: 'manager',
|
||||
/* eslint-enable object-shorthand */
|
||||
})
|
||||
);
|
||||
};
|
||||
</script>
|
||||
|
@ -115,11 +115,20 @@
|
||||
window.onerror = function onerror(message, source, line, column, err) {
|
||||
if (window.CONFIG_TYPE !== 'DEVELOPMENT') return;
|
||||
// eslint-disable-next-line no-var, vars-on-top
|
||||
var error = { message: err.message, name: err.name, stack: err.stack };
|
||||
window.fetch('/runtime-error', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ message, source, line, column, error, origin: 'preview' }),
|
||||
});
|
||||
var xhr = new window.XMLHttpRequest();
|
||||
xhr.open('POST', '/runtime-error');
|
||||
xhr.setRequestHeader('Content-Type', 'application/json;charset=UTF-8');
|
||||
xhr.send(
|
||||
JSON.stringify({
|
||||
/* eslint-disable object-shorthand */
|
||||
message: message,
|
||||
source: source,
|
||||
line: line,
|
||||
column: column,
|
||||
error: { message: err.message, name: err.name, stack: err.stack },
|
||||
origin: 'preview',
|
||||
/* eslint-enable object-shorthand */
|
||||
})
|
||||
);
|
||||
};
|
||||
</script>
|
||||
|
Loading…
x
Reference in New Issue
Block a user