I have an error when implement AppLocalizeBehavior in LitElement

19 views
Skip to first unread message

Juan Lorenzo Llanes

unread,
Jan 23, 2019, 8:06:53 PM1/23/19
to Polymer
Hi everyone

I'm working whith pwa-starter-kit LitElement and AppLocalizeBehavior and I have the following error when I implement AppLocalizeBehavior in LitElement app

---package.json ---

"dependencies": {
   
"@polymer/app-layout": "^3.0.0",
   
"@polymer/app-localize-behavior": "^3.0.1",
   
"@polymer/polymer": "^3.1.0",
   
"@webcomponents/webcomponentsjs": "^2.2.4",
   
"lit-element": "^2.0.0-rc.3",
   
"pwa-helpers": "^0.9.0",
   
"redux": "^4.0.0",
   
"redux-thunk": "^2.3.0",
   
"reselect": "^4.0.0"
 
},
 
"devDependencies": {
   
"@polymer/test-fixture": "^4.0.2",
   
"axe-core": "^3.0.0",
   
"chai": "^4.1.2",
   
"del": "^3.0.0",
   
"gulp": "^4.0.0",
   
"gulp-rename": "^1.3.0",
   
"gulp-replace": "^1.0.0",
   
"mocha": "^5.2.0",
   
"pixelmatch": "^4.0.2",
   
"polymer-cli": "^1.9.3",
   
"polyserve": "^0.27.0",
   
"prpl-server": "^1.4.0",
   
"puppeteer": "^1.5.0",
   
"wct-mocha": "^1.0.0"
 
}




--- old my-app.js--

class MyApp extends connect(store)(LitElement) {
   
....



---AppLocalizeBehavior my-app.js ---



import {mixinBehaviors} from '@polymer/polymer/lib/legacy/class.js';
import {AppLocalizeBehavior} from '@polymer/app-localize-behavior/app-localize-behavior.js';




class MyApp extends connect(store)(mixinBehaviors([AppLocalizeBehavior],LitElement)) {
 
.....

----- ERROR--------------

 
updating-element.ts:487 Uncaught TypeError: Cannot read property 'forEach' of undefined
    at
HTMLElement._saveInstanceProperties (updating-element.ts:487)
    at
HTMLElement.initialize (updating-element.ts:467)
    at
HTMLElement.initialize (lit-element.ts:130)
    at
new UpdatingElement (updating-element.ts:230)
    at
new LitElement (lit-element.ts:76)
    at
new PropertiesChanged (properties-changed.js:170)
    at
new PropertyAccessors (property-accessors.js:115)
    at
new TemplateStamp (template-stamp.js:125)
    at
new PropertyEffects (property-effects.js:1195)
    at
new PropertiesMixin (properties-mixin.js:115)



Thanks in advance

Justin Fagnani

unread,
Jan 23, 2019, 11:24:35 PM1/23/19
to Juan Lorenzo Llanes, Polymer
Polymer Behaviors are a Polymer-specific abstraction, and you can't apply them to non-Polymer elements even as a mixin because they assume certain API from the base class that LitElement doesn't provide.

I don't know much about AppLocalizeBehavior for FormatJS, but in this case I think you should be able to use FormatJS directly.

Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups "Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to polymer-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/polymer-dev/4de87ba7-005d-441c-aea6-a11f2be159ed%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages