Some checks failed
Axolotl desktop CI / guardrails (push) Has been cancelled
Axolotl desktop CI / desktop (macos-latest) (push) Has been cancelled
Axolotl desktop CI / desktop (ubuntu-latest) (push) Has been cancelled
Axolotl desktop CI / desktop (windows-latest) (push) Has been cancelled
Axolotl desktop CI / website (push) Has been cancelled
Repository checks / typos (push) Has been cancelled
Repository checks / tombi (push) Has been cancelled
Rust checks / shear (push) Has been cancelled
Sync source to CNB / Sync Git ref (push) Has been cancelled
33 lines
969 B
JavaScript
33 lines
969 B
JavaScript
;(() => {
|
|
const isEditor =
|
|
location.origin === 'http://axolotl-skin.localhost' ||
|
|
(location.protocol === 'axolotl-skin:' && location.host === 'localhost') ||
|
|
(location.origin === 'http://localhost:5201' &&
|
|
location.pathname === '/__blockbench_skin__/index.html')
|
|
if (
|
|
!isEditor ||
|
|
window.parent === window ||
|
|
new URLSearchParams(location.search).get('embed') !== 'skin'
|
|
)
|
|
return
|
|
|
|
function report(error) {
|
|
window.parent.postMessage(
|
|
{ type: 'axolotl-skin-load-error', error: String(error).slice(0, 1000) },
|
|
'*',
|
|
)
|
|
}
|
|
window.addEventListener('error', (event) => {
|
|
if (event.message) {
|
|
if (event.message.startsWith('ResizeObserver loop')) return
|
|
report(event.message)
|
|
}
|
|
})
|
|
window.addEventListener('unhandledrejection', (event) => {
|
|
report(event.reason?.message || event.reason)
|
|
})
|
|
window.addEventListener('DOMContentLoaded', () => {
|
|
window.blockbenchBundleReady?.catch((error) => report(error?.message || error))
|
|
})
|
|
})()
|