Skip to content

Simplify module interface #1764

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 21 additions & 16 deletions build_runner/lib/src/server/hot_reload_client/client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,26 +69,31 @@ class ModuleWrapper implements Module {
ModuleWrapper(this._internal);

@override
bool get hasOnDestroy =>
_internal != null && hasProperty(_internal, r'hot$onDestroy');
Object onDestroy() {
if (_internal != null && hasProperty(_internal, r'hot$onDestroy')) {
return _internal.hot$onDestroy();
}
return null;
}

@override
bool get hasOnSelfUpdate =>
_internal != null && hasProperty(_internal, r'hot$onSelfUpdate');
bool onSelfUpdate([Object data]) {
if (_internal != null && hasProperty(_internal, r'hot$onSelfUpdate')) {
return _internal.hot$onSelfUpdate(data);
}
// ignore: avoid_returning_null
return null;
}

@override
bool get hasOnChildUpdate =>
_internal != null && hasProperty(_internal, r'hot$onChildUpdate');

@override
Object onDestroy() => _internal.hot$onDestroy();

@override
bool onSelfUpdate([Object data]) => _internal.hot$onSelfUpdate(data);

@override
bool onChildUpdate(String childId, Module child, [Object data]) => _internal
.hot$onChildUpdate(childId, (child as ModuleWrapper)._internal, data);
bool onChildUpdate(String childId, Module child, [Object data]) {
if (_internal != null && hasProperty(_internal, r'hot$onChildUpdate')) {
return _internal.hot$onChildUpdate(
childId, (child as ModuleWrapper)._internal, data);
}
// ignore: avoid_returning_null
return null;
}
}

@JS('Map')
Expand Down
Loading