Defining a global filter/transformer in Polymer.dart
Asked Answered
R

1

6

Is there a way to define a global transformer that will be available in all custom elements?

Roberto answered 26/8, 2013 at 12:12 Comment(0)
C
3

I'm not aware of a global way to define a transformer, but I use the following workaround: I have a class containing my global transformers, that are included into my custom elements using a mixin. Put it into a library that you include into every element. My global transformer mixin:

abstract class GlobalTransformersMixin extends Object implements Observable {
  @observable
  final Transformer asInteger = new _StringToInt();
  //...
}

Using it in an custom element:

@CustomTag('my-elment')
class MyElement extends PolymerElement with GlobalTransformersMixin {
    //...
}
Chambertin answered 18/9, 2014 at 10:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.