Last active
May 18, 2016 12:06
-
-
Save matteodepalo/806dc2c768dbe975a6375d2d2678f51d to your computer and use it in GitHub Desktop.
pipe
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.Component.extend({ | |
value: 'test', | |
printValue: Ember.observer('value', function() { | |
console.log(this.get('value')) | |
}), | |
actions: { | |
setValue: function(value) { | |
return this.set('value', value); | |
} | |
} | |
}); |
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', | |
onInput: function(value) { | |
alert(value); | |
return value; | |
} | |
}); |
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'; | |
const { Helper: { helper } } = Ember; | |
export function pipe(actions = []) { | |
return function(...args) { | |
return actions.reduce((acc, curr, idx) => { | |
if (idx === 0) { | |
return curr(...args); | |
} | |
return curr(acc); | |
}, undefined); | |
}; | |
} | |
export default helper(pipe); |
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.8.1", | |
"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.5.1", | |
"ember-data": "2.5.2", | |
"ember-template-compiler": "2.5.1", | |
"ember-composable-helpers": "0.24.1" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment