Hi!

I did get it working, with a hack. Problem is TypeScript not the polymer.

https://gist.github.com/Ciantic/9db1b6281bd7a743ffb5

See files "MyElement.ts" "index.html" and "index.js".

The long file "customelement.ts" is workaround, since TypeScript doesn't 
allow inheriting from interface *without* implementing all items, so they 
are just copy & pasted from HTMLElement interface.

On Tuesday, October 21, 2014 7:20:06 AM UTC+3, [email protected] wrote:
>
> Did you find a way to solve this?
>
> You can do something like this:
>
> class MyElement {
>
>     age = 25;
>     name = "Daniel";
>     color = "red";
>     owner = "Eric";
>
>     //setFocus() {       
>     //    this.$.nameInput.focus();
>     //}
> }
>
> Polymer(new MyElement());
>
> That works, but the problem is you cant access the $ or any other special 
> polymer properties. Any clues?
>
> Mike
>
> On Friday, 27 June 2014 05:13:07 UTC+8, [email protected] wrote:
>>
>> Hello!
>>
>> I've been looking Polymer for a year now, and still this syntax:
>>
>>     Polymer('seed-element', {
>>       author: 'Dimitri Glazkov',
>>       fancy: false,
>>       ready: function() {
>>       },
>>       sayHello: function(greeting) {
>>         var response = greeting || 'Hello World!';
>>         return 'seed-element says, ' + response;
>>       },
>>       fireLasers: function() {
>>         this.fire('seed-element-lasers-success', { sound: 'Pew pew pew!' 
>> });
>>       }
>>     });
>>
>> Gives me creeps. Not a single IDE will support anything useful for that 
>> syntax. Why this syntax is like this? It should follow the biggest 
>> Javascript libraries to achive greater interoperability, e.g. Backbone 
>> and inheritance <http://www.erichynds.com/blog/backbone-and-inheritance>
>>
>> I really like TypeScript, and I suspect above kind of syntax does not 
>> allow normal inheritance. If the Polymer were made to follow semi-standard, 
>> one could simply inherit from Polymer element. So one could in TypeScript 
>> use familiar:
>>
>>     class SeedElement extends PolymerElement  {
>>         fancy: boolean = false
>>         author: string = "Dimitri Glazkov"
>>         public sayHello (greeting: String) {
>>             
>>         }
>>         
>>         public fireLasers () {
>>             
>>         }
>>     }
>>
>> All it takes, I suspect is to have normal "javascript inheritance" in 
>> Polymer, just like in Backbone (e.g. I can already inherit from 
>> Backbone.View using TypeScript syntax) it's pure JavaScript library.
>>
>> Thanks.
>>
>

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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/polymer-dev/7ec73631-d5cf-47af-ac3a-6089c3faf339%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to