Discussion:
[dart-misc] missing definitions howto
Peter StJ
2016-10-22 21:06:57 UTC
Permalink
So I am writing some code in dart and from time to time there are
properties that dart is missing on certain objects. Current example is
'strokeDashoffset' and 'strokeDasharray' in the SVG's CSSStyleDeclaration
object.

Of course I am interested on how to fix this one, but in more general
sense: are there any ways to declare additional properties on an object for
Dart to know about and use (and correctly compile to JS) similar to how we
deal with it in Closure/TypeScript (i.e. externs/definitions/declares
etc). I am aware of the JS interop options, but this is really not the
case, I am actually trying to use something that is there and is part of
the platform and should get compiled to correct properties in JS.

Thanks.
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
Matan Lurey
2016-10-24 12:47:43 UTC
Permalink
It looks like dart:html is a little out of date here.

You can always use package:js to "decorate" a dart:html Element and add
additional properties for now (it will get compiled properly).

Most of the Dart team is away for the dev summit this week, but it's worth
filing a bug at dart-lang/sdk for tracking.

~ Matan
Post by Peter StJ
So I am writing some code in dart and from time to time there are
properties that dart is missing on certain objects. Current example is
'strokeDashoffset' and 'strokeDasharray' in the SVG's CSSStyleDeclaration
object.
Of course I am interested on how to fix this one, but in more general
sense: are there any ways to declare additional properties on an object for
Dart to know about and use (and correctly compile to JS) similar to how we
deal with it in Closure/TypeScript (i.e. externs/definitions/declares
etc). I am aware of the JS interop options, but this is really not the
case, I am actually trying to use something that is there and is part of
the platform and should get compiled to correct properties in JS.
Thanks.
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
Günter Zöchbauer
2016-10-24 16:09:10 UTC
Permalink
Is there an example somewhere?
How would that look like?
Post by Matan Lurey
It looks like dart:html is a little out of date here.
You can always use package:js to "decorate" a dart:html Element and add
additional properties for now (it will get compiled properly).
Most of the Dart team is away for the dev summit this week, but it's worth
filing a bug at dart-lang/sdk for tracking.
~ Matan
Post by Peter StJ
So I am writing some code in dart and from time to time there are
properties that dart is missing on certain objects. Current example is
'strokeDashoffset' and 'strokeDasharray' in the SVG's CSSStyleDeclaration
object.
Of course I am interested on how to fix this one, but in more general
sense: are there any ways to declare additional properties on an object for
Dart to know about and use (and correctly compile to JS) similar to how we
deal with it in Closure/TypeScript (i.e. externs/definitions/declares
etc). I am aware of the JS interop options, but this is really not the
case, I am actually trying to use something that is there and is part of
the platform and should get compiled to correct properties in JS.
Thanks.
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
Peter StJ
2016-11-17 15:45:41 UTC
Permalink
Sorry to get back to this, but looks like no generic answer was found (even
thou the proposed workaround works). How do we do this 'decoration' on
existing 'native' objects?

Thanks
Post by Günter Zöchbauer
Is there an example somewhere?
How would that look like?
Post by Matan Lurey
It looks like dart:html is a little out of date here.
You can always use package:js to "decorate" a dart:html Element and add
additional properties for now (it will get compiled properly).
Most of the Dart team is away for the dev summit this week, but it's
worth filing a bug at dart-lang/sdk for tracking.
~ Matan
Post by Peter StJ
So I am writing some code in dart and from time to time there are
properties that dart is missing on certain objects. Current example is
'strokeDashoffset' and 'strokeDasharray' in the SVG's CSSStyleDeclaration
object.
Of course I am interested on how to fix this one, but in more general
sense: are there any ways to declare additional properties on an object for
Dart to know about and use (and correctly compile to JS) similar to how we
deal with it in Closure/TypeScript (i.e. externs/definitions/declares
etc). I am aware of the JS interop options, but this is really not the
case, I am actually trying to use something that is there and is part of
the platform and should get compiled to correct properties in JS.
Thanks.
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
Peter StJ
2016-10-24 20:19:18 UTC
Permalink
A small example of the approach would be much appreciated indeed.

Thank you.
Post by Matan Lurey
It looks like dart:html is a little out of date here.
You can always use package:js to "decorate" a dart:html Element and add
additional properties for now (it will get compiled properly).
Most of the Dart team is away for the dev summit this week, but it's worth
filing a bug at dart-lang/sdk for tracking.
~ Matan
Post by Peter StJ
So I am writing some code in dart and from time to time there are
properties that dart is missing on certain objects. Current example is
'strokeDashoffset' and 'strokeDasharray' in the SVG's CSSStyleDeclaration
object.
Of course I am interested on how to fix this one, but in more general
sense: are there any ways to declare additional properties on an object for
Dart to know about and use (and correctly compile to JS) similar to how we
deal with it in Closure/TypeScript (i.e. externs/definitions/declares
etc). I am aware of the JS interop options, but this is really not the
case, I am actually trying to use something that is there and is part of
the platform and should get compiled to correct properties in JS.
Thanks.
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
Greg Lowe
2016-10-25 06:10:22 UTC
Permalink
Not an answer to the more general question, however for css you can use
setProperty.

For example:
element.style.setProperty('font-size', '40px');
Post by Peter StJ
A small example of the approach would be much appreciated indeed.
Thank you.
Post by Matan Lurey
It looks like dart:html is a little out of date here.
You can always use package:js to "decorate" a dart:html Element and add
additional properties for now (it will get compiled properly).
Most of the Dart team is away for the dev summit this week, but it's
worth filing a bug at dart-lang/sdk for tracking.
~ Matan
Post by Peter StJ
So I am writing some code in dart and from time to time there are
properties that dart is missing on certain objects. Current example is
'strokeDashoffset' and 'strokeDasharray' in the SVG's CSSStyleDeclaration
object.
Of course I am interested on how to fix this one, but in more general
sense: are there any ways to declare additional properties on an object for
Dart to know about and use (and correctly compile to JS) similar to how we
deal with it in Closure/TypeScript (i.e. externs/definitions/declares
etc). I am aware of the JS interop options, but this is really not the
case, I am actually trying to use something that is there and is part of
the platform and should get compiled to correct properties in JS.
Thanks.
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
Continue reading on narkive:
Loading...