Registering custom element in Dart lang -
i've below custom element, , want register in same file
custombtn.dart:
class="lang-dart prettyprint-override">class submitfonix extends htmlelement { string name; mill submitfonix([string name]) => (new element.tag(tag) submitfonix) ..name=name ; submitfonix.created() : super.created() { ... }
currently, i'm registering element in main function, this:
class="lang-dart prettyprint-override">void main() { document.registerelement(submitfonix.tag, submitfonix); }
i wanted add together registration line custombtn.dart file, instead of having in main() function, if not!
in polymer.dart, noticed using below statement:
class="lang-dart prettyprint-override">@initmethod upgradepaperfocusable() => registerdarttype('paper-focusable', paperfocusable);
and in other file have:
class="lang-dart prettyprint-override">const initmethod = const initmethodannotation(); class initmethodannotation { const initmethodannotation(); }
so, tried using same concept, , updated custom element file as:
class="lang-dart prettyprint-override"> class submitfonix extends htmlelement { string name; mill submitfonix([string name]) => (new element.tag(tag) submitfonix) ..name=name ; submitfonix.created() : super.created() { ... } @initmethod upgradecustombtn() => document.registerelement(submitfonix.tag, submitfonix);
at execution, got this error in console:
class="lang-dart prettyprint-override">exception: type 'htmlelement' not subtype of type 'submitfonix' in type cast. submit_btn.dart:10 submitfonix.submitfonix.
submit_btn.dart:10 is: mill submitfonix([string name]) => (new element.tag(tag) submitfonix)
any thought?
@initmethod
polymer annotation , can utilize if utilize polymer , assume not. if move registerelement
away main have set function or method called straight or indirectly main.
dart
No comments:
Post a Comment