Skip to content

Commit

Permalink
expose ReactorVar#setDependency
Browse files Browse the repository at this point in the history
  • Loading branch information
Vishnu Rajeevan committed Jan 27, 2015
1 parent 7857ec0 commit d3d873c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ public void react(ReactorComputation reactorComputation) {
mEditTextDisplay.setText(mViewModel.getEditTextValue());
}
});

Reactor.getInstance().autoRun(new ReactorComputationFunction() {
@Override
public void react(ReactorComputation reactorComputation) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class ReactorComputation {
private final int mId;
private final ArrayList<ReactorInvalidateCallback> mInvalidateCallbacks;
private final ReactorComputation mParent;

private final ReactorComputationFunction mFunction;

public boolean isStopped() {
Expand Down
10 changes: 8 additions & 2 deletions reactor/src/main/java/io/dwak/reactor/ReactorVar.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,22 @@ public ReactorVar(T value) {
}

public T getValue() {
mDependency.depend();
if(mDependency !=null)
mDependency.depend();
return mValue;
}

public void setValue(T value) {
this.mValue = value;
mDependency.changed();
if(mDependency != null)
mDependency.changed();
}

public ReactorDependency getDependency() {
return mDependency;
}

public void setDependency(ReactorDependency dependency) {
mDependency = dependency;
}
}

0 comments on commit d3d873c

Please sign in to comment.