Last active
August 2, 2020 17:19
-
-
Save toranb/2d98cd4418b7df5cbce6c5213351d31e to your computer and use it in GitHub Desktop.
New Twiddle
This file contains 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
import Ember from 'ember'; | |
import hbs from 'htmlbars-inline-precompile'; | |
import connect from 'ember-redux/components/connect'; | |
var stateToComputed = (state) => { | |
return { | |
number: state.number | |
}; | |
}; | |
var dispatchToActions = (dispatch) => { | |
return { | |
add: () => dispatch({type: 'ADD'}) | |
}; | |
}; | |
var NumbersComponent = Ember.Component.extend({ | |
layout: hbs` | |
{{number}} | |
<button onclick={{action "add"}}>add</button> | |
` | |
}); | |
export default connect(stateToComputed, dispatchToActions)(NumbersComponent); |
This file contains 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
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle' | |
}); |
This file contains 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 number = ((state, action) => { | |
if(action.type === 'ADD') { | |
return state + 1; | |
} | |
return state || 0; | |
}); | |
export default { | |
number | |
} |
This file contains 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
{ | |
"version": "0.11.0", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "2.10.2", | |
"ember-data": "2.11.0", | |
"ember-template-compiler": "2.10.2", | |
"ember-testing": "2.10.2" | |
}, | |
"addons": { | |
"ember-redux": "2.0.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment