Pixi.JS 不适用于移动设备,因为 AccessibilityManager 抛出错误

Pixi.JS don't work on mobile devices couse AccessibilityManager throw error

当我点击 chrome "toogle device toolbar" 并且浏览器进入移动模式时 pixi.js 将无法正常工作。我在SAMSUNG A3上也有同样的问题。

bundle.js:19086 Uncaught TypeError: Cannot read property 'appendChild' of null at AccessibilityManager.createTouchHook

我修好了。我的错...我试图在文档完全加载之前创建 PIXI.Application。在桌面版中没有问题,但在移动版中它的工作不正确,因为使用 createTouchHook 尝试将子元素附加到文档正文。

错误代码:

let app = new PIXI.Application(config.screen.width, config.screen.height, { transparent: true });

 $(document).ready(function(){
     //some actions with pixi.js
 });

正确的代码是:

$(document).ready(function() {
    let app = new PIXI.Application(config.screen.width, config.screen.height, { transparent: true });
});