reduxed 0.0.2
A redux/flux like store in D
To use this package, run the following command in your project's root directory:
Manual usage
Put the following dependency into your project's dependences section:
reduxed
A library implementing the redux/flux pattern for the D Progamming Language.
// Define your store as a struct
struct Bar {
int b;
int a;
}
// Create the store
FluxStore!Bar store;
// set store init values
store.a = 1;
store.b = 2;
int a = 1337;
// We use this function to observe Bar.a
void fun(ref const(int) f) @safe {
a = f;
}
// Here we subscribe to Bar.a
// Whenever Bar.a changes "fun" gets called
store.a.subscribe(&fun);
// This function is used to change the value
static int increment(int a, int b) pure {
return a + b;
}
// Here we call increment with the values of store.a and store.b
// the effect is equal to
// store.a = increment(store.a, store.b);
store.execute!(increment)(store.a, store.b);
assert(store.a.value == 3);
assert(a == 3);
- Registered by Robert Schadek
- 0.0.2 released 6 years ago
- burner/reduxed
- LGPL3
- Copyright © 2018, burner
- Authors:
- Dependencies:
- none
- Versions:
-
0.0.3 2018-Aug-23 0.0.2 2018-Aug-21 0.0.1 2018-Aug-21 ~master 2018-Aug-23 - Download Stats:
-
-
0 downloads today
-
0 downloads this week
-
0 downloads this month
-
9 downloads total
-
- Score:
- 0.6
- Short URL:
- reduxed.dub.pm