Binks
November 12, 2016, 1:13pm
#1
Hello, i’m trying to destroy application, but getting error. What can i do to solve this issue?
Here is log:
TypeError: this.registry._loader.getHandler(...) is undefined
Asset.prototype.getPreferredFile
Asset.prototype.getFileUrl
Asset.prototype.unload
Application.prototype.destroy
Here is code, where error appears:
...
if (this.type === "texture") {
var device = this.registry._loader.getHandler("texture")._device;
...
Here is my scene:
https://playcanvas.com/editor/scene/474007
If anyone can help, I’d greatly appreciate it!
steven
November 12, 2016, 8:43pm
#2
I’m looking at the project you linked to but there is no code there to look at? On top of that, what is the need for destroying the app object?
Binks
November 13, 2016, 6:52am
#3
Code doesn’t matter, because even if you try to call app.destroy() in just generated project, without any changes in it, you’ll get this error. The need for destroying is that i have fullpage scroll, where many of sections are without webGL content, so to optimize perfomance i want destroy the app, when it is out of sight.
steven
November 13, 2016, 9:15pm
#4
Binks:
The need for destroying is that i have fullpage scroll, where many of sections are without webGL content, so to optimize perfomance i want destroy the app, when it is out of sight.
Ah, I see… In that case, it would be easier to hide or remove the iframe of the application on the webpage?
Edit: Example:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<!--<meta name="viewport" content="width=device-width, initial-scale=1.0">-->
<title>untitled document</title>
<style>
body{
margin:0;
}
.embedVideo {
position:relative;
padding-bottom:56.25%;
height:0;
}
.embedVideo iframe{
position:absolute;
top:0;
left:0;
width:100%;
height:100%;
border:0;
}
</style>
<script>
function removeContent() {
document.getElementById('foobar').innerHTML = '';
}
</script>
</head>
<body>
<div id="foobar" class="embedVideo">
<iframe id='frame'
src='http://s3-eu-west-1.amazonaws.com/apps.playcanvas.com/nm4ZdNS6/index.html?overlay=false'
webkitallowfullscreen='true'
mozallowfullscreen='true'
allowfullscreen='true'
allowvr
scrolling='no'
frameBorder='0'>
</iframe>
</div>
<button onclick="removeContent()">Remove content</button>
</body>
</html>
1 Like
niksel
January 19, 2018, 11:58am
#5
This bug is still present as of today – I can see many use cases for a method for destroying the whole app, which is why I reckon the function is there, but it’s throwing these errors when run. Has anybody found a workaround for this?