简体   繁体   English

在Apache Cordova Windows App中使用聚合物

[英]Using polymer for apache cordova windows app

I was playing around with building an apache cordova app for windows but also using the new polymer that google built. 我不仅在为Windows构建一个Apache Cordova应用程序,而且还在使用Google构建的新聚合物。 I have no problem running the basic app that is created for windows by cordova in the emulator. 我在运行模拟器中由cordova为Windows创建的基本应用程序时没有问题。 I also have no problem running a simple polymer version on my localhost in chrome. 我也没有问题在chrome本地主机上运行简单的聚合物版本。 However, when I try to run that simple polymer version in the emulator, I run into problems. 但是,当我尝试在模拟器中运行该简单的聚合物版本时,遇到了问题。

Here is the first error I run into at this line originalInsertBefore.call(unsafeUnwrap(this), unwrap(childWrapper), refNode); 这是我在此行遇到的第一个错误originalInsertBefore.call(unsafeUnwrap(this), unwrap(childWrapper), refNode); in the webcomponents.js file: 在webcomponents.js文件中:

"Unhandled exception at line 1801, column 15 in ms-appx://com.test.testing/www/bower_components/webcomponentsjs/webcomponents.js “ ms-appx://com.test.testing/www/bower_components/webcomponentsjs/webcomponents.js中第1801行第15列的未处理异常

0x800c001c - JavaScript runtime error: Unable to add dynamic content. 0x800c001c-JavaScript运行时错误:无法添加动态内容。 A script attempted to inject dynamic content, or elements previously modified dynamically, that might be unsafe. 脚本试图注入可能不安全的动态内容或先前动态修改的元素。 For example, using the innerHTML property to add script or malformed HTML will generate this exception. 例如,使用innerHTML属性添加脚本或格式错误的HTML会生成此异常。 Use the toStaticHTML method to filter dynamic content, or explicitly create elements and attributes with a method such as createElement. 使用toStaticHTML方法过滤动态内容,或使用诸如createElement之类的方法显式创建元素和属性。 For more information, see http://go.microsoft.com/fwlink/?LinkID=247104 ". 有关更多信息,请参见http://go.microsoft.com/fwlink/?LinkID=247104

Now I googled this and saw that MS had put in that loading in dynamic content was not allowed but that apparently there was a fix which is the below: 现在,我在Google上进行了搜索,发现MS不允许加载动态内容,但显然存在以下修复程序:

 MSApp.execUnsafeLocalFunction(function () {
    originalInsertBefore.call(unsafeUnwrap(this), unwrap(childWrapper), refNode);
 });

This results in getting past that first error but instead results in this: 这导致超过第一个错误,但导致以下结果:

"Unhandled exception at line 293, column 7 in ms-appx://com.asquared.packinglist/www/bower_components/webcomponentsjs/webcomponents.js “第293行的ms-appx://com.asquared.packinglist/www/bower_components/webcomponentsjs/webcomponents.js中未处理的异常

0x800a138f - JavaScript runtime error: Unable to get property ' impl4cf1e782hg ' of undefined or null reference" 0x800a138f-JavaScript运行时错误:无法获取未定义或空引用的属性' impl4cf1e782hg '

at this line: 在这一行:

function unsafeUnwrap(wrapper) {
  return wrapper.__impl4cf1e782hg__;
}

I don't actually have much experience with windows apps, so I'm not really certain about the difference between windows 8.1 apps vs windows 8.1 phone apps and "store" apps but currently I'm just trying to run it on "Local Machine" in visual studio. 我实际上对Windows应用程序没有太多的经验,所以我不确定Windows 8.1应用程序与Windows 8.1电话应用程序和“存储”应用程序之间的区别,但目前我只是尝试在“本地计算机”上运行在Visual Studio中。

Has anyone run into this before? 有人遇到过吗? I realize that polymer is very new tech so there might not be much out there but any help would be appreciated. 我意识到聚合物是一项非常新的技术,因此可能没有很多,但我们将不胜感激。

Thanks, 谢谢,

Use the following fix to get rid of this security error: https://github.com/MsopenTech/winstore-jscompat 使用以下修复程序消除此安全错误: https : //github.com/MsopenTech/winstore-jscompat

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM