Last active
August 29, 2015 14:14
-
-
Save lxcodes/76f8d0ba3b2cb1c983c7 to your computer and use it in GitHub Desktop.
Revisions
-
lxcodes revised this gist
Feb 6, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ #### Saved from https://github.com/emberjs/ember.js/issues/5462 The Ghost folks have a [great implementation](https://github.com/TryGhost/Ghost/blob/master/core/client/utils/bound-one-way.js): ```js -
lxcodes revised this gist
Feb 6, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ ### Saved from https://github.com/emberjs/ember.js/issues/5462 The Ghost folks have a [great implementation](https://github.com/TryGhost/Ghost/blob/master/core/client/utils/bound-one-way.js): ```js /** * Defines a property similarly to `Ember.computed.oneway`, * save that while a `oneway` loses its binding upon being set, -
lxcodes revised this gist
Feb 6, 2015 . 1 changed file with 3 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ ### Saved from https://github.com/emberjs/ember.js/issues/5462 The Ghost folks have a [great implementation](https://github.com/TryGhost/Ghost/blob/master/core/client/utils/bound-one-way.js): ``` /** * Defines a property similarly to `Ember.computed.oneway`, * save that while a `oneway` loses its binding upon being set, @@ -21,4 +21,5 @@ var BoundOneWay = function (upstream, transform) { }); }; export default BoundOneWay; ``` -
lxcodes created this gist
Feb 6, 2015 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ ### Saved from https://github.com/emberjs/ember.js/issues/5462 The Ghost folks have a [great implementation](https://github.com/TryGhost/Ghost/blob/master/core/client/utils/bound-one-way.js): /** * Defines a property similarly to `Ember.computed.oneway`, * save that while a `oneway` loses its binding upon being set, * the `BoundOneWay` will continue to listen for upstream changes. * * This is an ideal tool for working with values inside of {{input}} * elements. * @param transform: a function to transform the **upstream** value. */ var BoundOneWay = function (upstream, transform) { if (typeof transform !== 'function') { //default to the identity function transform = function (value) { return value; }; } return Ember.computed(upstream, function (key, value) { return arguments.length > 1 ? value : transform(this.get(upstream)); }); }; export default BoundOneWay;