Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

Commit e706b93

Browse files
committed
Fixed some formatting
1 parent 308d8dc commit e706b93

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed

lib/directive/ng_model.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ class NgModel extends NgControl implements AttachAware {
195195

196196
get viewValue => _viewValue;
197197
void set viewValue(value) {
198-
_viewValue = value;
198+
_viewValue = value;
199199
modelValue = value;
200200
}
201201

lib/directive/ng_model_options.dart

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,35 +7,43 @@ class NgModelOptions {
77
int _debounceChangeValue;
88
int _debounceInputValue;
99

10+
async.Timer _blurTimer;
11+
async.Timer _changeTimer;
12+
async.Timer _inputTimer;
13+
1014
static const String _DEBOUNCE_DEFAULT_KEY = "default";
1115
static const String _DEBOUNCE_BLUR_KEY = "blur";
1216
static const String _DEBOUNCE_CHANGE_KEY = "change";
1317
static const String _DEBOUNCE_INPUT_KEY = "input";
1418

1519
NgModelOptions(NodeAttrs attrs) {
16-
Map options = convert.JSON.decode(attrs["ng-model-options"].replaceFirst("debounce", "'debounce'").replaceAll("'", "\""));
20+
var jsonFormattedOptions = attrs["ng-model-options"].replaceFirst("debounce", "'debounce'")
21+
.replaceAll("'", "\"");
22+
Map options = convert.JSON.decode(jsonFormattedOptions);
1723

18-
if (options["debounce"].containsKey(_DEBOUNCE_DEFAULT_KEY)){
19-
_debounceDefaultValue = options["debounce"][_DEBOUNCE_DEFAULT_KEY];
24+
if(options["debounce"] is int){
25+
_debounceDefaultValue = options["debounce"];
26+
}else{
27+
if (options["debounce"].containsKey(_DEBOUNCE_DEFAULT_KEY)){
28+
_debounceDefaultValue = options["debounce"][_DEBOUNCE_DEFAULT_KEY];
29+
}
30+
_debounceBlurValue = options["debounce"][_DEBOUNCE_BLUR_KEY];
31+
_debounceChangeValue = options["debounce"][_DEBOUNCE_CHANGE_KEY];
32+
_debounceInputValue = options["debounce"][_DEBOUNCE_INPUT_KEY];
2033
}
21-
_debounceBlurValue = options["debounce"][_DEBOUNCE_BLUR_KEY];
22-
_debounceChangeValue = options["debounce"][_DEBOUNCE_CHANGE_KEY];
23-
_debounceInputValue = options["debounce"][_DEBOUNCE_INPUT_KEY];
2434
}
2535

26-
async.Timer _blurTimer;
36+
2737
void executeBlurFunc(func()) {
2838
var delay = _debounceBlurValue == null ? _debounceDefaultValue : _debounceBlurValue;
29-
_blurTimer = _runFuncDebounced(delay, func,_blurTimer);
39+
_blurTimer = _runFuncDebounced(delay, func, _blurTimer);
3040
}
3141

32-
async.Timer _changeTimer;
3342
void executeChangeFunc(func()) {
3443
var delay = _debounceChangeValue == null ? _debounceDefaultValue : _debounceChangeValue;
3544
_changeTimer = _runFuncDebounced(delay, func, _changeTimer);
3645
}
3746

38-
async.Timer _inputTimer;
3947
void executeInputFunc(func()) {
4048
var delay = _debounceInputValue == null ? _debounceDefaultValue : _debounceInputValue;
4149
_inputTimer = _runFuncDebounced(delay, func, _inputTimer);

0 commit comments

Comments
 (0)