Skip to content
Permalink
Browse files

feature: Added some init-vars for SimpleValueStore

  • Loading branch information...
MikeMitterer committed Nov 15, 2018
1 parent 199eeae commit 5e2bcff572bc12f42540de8b81f9009e0368300a
Showing with 7 additions and 5 deletions.
  1. +2 −2 lib/directive/components/interfaces/stores.dart
  2. +5 −3 lib/m4d_directive.dart
@@ -9,6 +9,6 @@ abstract class SimpleDataStore extends Emitter {
}

abstract class SimpleValueStore extends SimpleDataStore {
ObservableProperty<T> prop<T>(final String varname);
ObservableProperty<T> prop<T>(final String varname, {
final T initWith = null, final FormatObservedValue<T> formatter = null });
}

@@ -85,10 +85,12 @@ class DefaultSimpleDataStore extends Emitter implements SimpleValueStore {
bool contains(final String varname) => bindings.containsKey(varname);

@override
ObservableProperty<T> prop<T>(final String varname) {
ObservableProperty<T> prop<T>(final String varname,{
final T initWith = null, final FormatObservedValue<T> formatter = null }) {

if(!bindings.containsKey(varname)) {
bindings[varname] = ObservableProperty<T>(null);
print("$varname changed...");
bindings[varname] = ObservableProperty<T>(initWith, formatter: formatter);
//print("$varname changed...");
bindings[varname].onChange.listen((_) => emitChange());
}
return bindings[varname];

0 comments on commit 5e2bcff

Please sign in to comment.
You can’t perform that action at this time.