Skip to content
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

w_flux Migration: Action class to ActionV2 #237

Merged
merged 1 commit into from
Jan 19, 2024
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
4 changes: 2 additions & 2 deletions example/web/panel/modules/data_load_async_module.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class DataLoadAsyncModule extends Module {
// trigger non-blocking async load of data
listenToStream(_events.didLoadData.take(1),
(_) => specifyStartupTiming(StartupTimingType.firstUseful));
_actions.loadData();
_actions.loadData(null);
return Future.value();
}
}
Expand All @@ -66,7 +66,7 @@ class DataLoadAsyncComponents implements ModuleComponents {
}

class DataLoadAsyncActions {
final Action<Null> loadData = Action();
final ActionV2<Null> loadData = ActionV2();
}

DispatchKey _dispatchKey = DispatchKey('DataLoadAsync');
Expand Down
4 changes: 2 additions & 2 deletions example/web/panel/modules/flux_module.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class FluxComponents implements ModuleComponents {
}

class FluxActions {
final Action<Null> changeBackgroundColor = Action();
final ActionV2<Null> changeBackgroundColor = ActionV2();
}

class FluxStore extends Store {
Expand Down Expand Up @@ -85,7 +85,7 @@ class _MyFluxComponent extends FluxComponent<FluxActions, FluxStore> {
'This module uses a flux pattern to change its background color.',
react.button({
'style': {'padding': '10px', 'margin': '10px'},
'onClick': (_) => actions.changeBackgroundColor()
'onClick': (_) => actions.changeBackgroundColor(null)
}, 'Random Background Color')
]);
}
Expand Down
4 changes: 2 additions & 2 deletions example/web/panel/modules/hierarchy_module.dart
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ class HierarchyComponents implements ModuleComponents {
}

class HierarchyActions {
final Action<Module> addChildModule = Action<Module>();
final Action<Module> removeChildModule = Action<Module>();
final ActionV2<Module> addChildModule = ActionV2<Module>();
final ActionV2<Module> removeChildModule = ActionV2<Module>();
}

class HierarchyStore extends Store {
Expand Down
2 changes: 1 addition & 1 deletion example/web/panel/modules/panel_module.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class PanelComponents implements ModuleComponents {
}

class PanelActions {
final Action<num> changeToPanel = Action<num>();
final ActionV2<num> changeToPanel = ActionV2<num>();
}

class PanelStore extends Store {
Expand Down
4 changes: 2 additions & 2 deletions example/web/panel/modules/reject_module.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class RejectComponents implements ModuleComponents {
}

class RejectActions {
final Action<Null> toggleShouldUnload = Action();
final ActionV2<Null> toggleShouldUnload = ActionV2();
}

class RejectStore extends Store {
Expand Down Expand Up @@ -96,7 +96,7 @@ class _RejectComponent extends FluxComponent<RejectActions, RejectStore> {
'type': 'checkbox',
'label': 'shouldUnload',
'checked': store.shouldUnload,
'onChange': (_) => actions.toggleShouldUnload()
'onChange': (_) => actions.toggleShouldUnload(null)
}),
'shouldUnload'
])
Expand Down
8 changes: 4 additions & 4 deletions example/web/random_color/random_color.dart
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class RandomColorApi {
}

void changeBackgroundColor() {
_actions.changeBackgroundColor();
_actions.changeBackgroundColor(null);
}

String get currentBackgroundColor => _stores.backgroundColor;
Expand All @@ -121,8 +121,8 @@ class RandomColorComponents implements ModuleComponents {
}

class RandomColorActions {
final Action<Null> changeBackgroundColor = Action();
final Action<String> setBackgroundColor = Action();
final ActionV2<Null> changeBackgroundColor = ActionV2();
final ActionV2<String> setBackgroundColor = ActionV2();
}

class RandomColorStore extends Store {
Expand Down Expand Up @@ -176,7 +176,7 @@ class _RandomColorComponent
'This module uses a flux pattern to change its background color.',
react.button({
'style': {'padding': '10px', 'margin': '10px'},
'onClick': (_) => actions.changeBackgroundColor()
'onClick': (_) => actions.changeBackgroundColor(null)
}, 'Change Background Color'),
react.button({
'style': {'padding': '10px', 'margin': '10px'},
Expand Down
Loading