This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:overScrollMode="never"> | |
<RelativeLayout | |
android:id="@+id/rlProgress" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:overScrollMode="never"> | |
<RelativeLayout | |
android:id="@+id/rlProgress" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function createStore(reducer, preloadedState) { | |
if (typeof reducer !== 'function') { | |
throw new Error('Expected `reducer` to be a function.'); | |
} | |
if (typeof preloadedState === 'function') { | |
console.warn( | |
'Received function as `preloadedState`. ' + | |
'State is undefined.' | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function createStore(reducer, preloadedState) { | |
var currentState = preloadedState; | |
var listeners = []; | |
function getState() { | |
return currentState; | |
} | |
function subscribe(listener) { | |
listeners.push(listener); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function createStore(reducer, preloadedState) { | |
var currentState = preloadedState; | |
// Keep track of all listeners | |
var listeners = []; | |
function getState() { | |
return currentState; | |
} | |
// Subscribe new listeners to the store |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function createStore(reducer, preloadedState) { | |
// Store the current state | |
var currentState = preloadedState; | |
// Retrieve the current state | |
function getState() { | |
return currentState; | |
} | |
// Expose the API |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function createStore(reducer, preloadedState) { | |
// Our store implementation will go here... | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function counterReducer(state, action) { | |
switch (action.type) { | |
case actionTypes.increment: | |
return incrementHandler(state, action); | |
case actionTypes.decrement: | |
return decrementHandler(state, action); | |
default: | |
return state; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function incrementHandler(state, action) { | |
var nextState = Object.assign({}, state); | |
nextState.counter += 1; | |
return nextState; | |
} | |
function decrementHandler(state, action) { | |
var nextState = Object.assign({}, state); | |
nextState.counter -= 1; | |
return nextState; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var initialState = { | |
counter: 0, | |
}; |