Skip to content

Commit 96daaea

Browse files
committed
Switches function prototype extensions to Ember.computed
1 parent 507ce0b commit 96daaea

File tree

2 files changed

+18
-15
lines changed

2 files changed

+18
-15
lines changed

app/components/instance-item-list-item.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
import Ember from "ember";
22

3-
const { Component, get } = Ember;
3+
const { Component, get, computed } = Ember;
44

55
export default Component.extend({
66
tagName: 'li',
77
classNameBindings: ['type'],
8-
isVisible: function(){
8+
9+
isVisible: computed('show-private', 'show-protected', 'show-deprecated',
10+
'show-inherited', 'item.isPrivate', 'item.isProtected',
11+
'item.inheritedFrom', 'item.isDeprecated',
12+
function() {
913
if (get(this, 'item.isPrivate') && !get(this, 'show-private')) {
1014
return false;
1115
}
@@ -23,9 +27,8 @@ export default Component.extend({
2327
}
2428

2529
return true;
26-
}.property('show-private', 'show-protected', 'show-deprecated',
27-
'show-inherited', 'item.isPrivate', 'item.isProtected',
28-
'item.inheritedFrom', 'item.isDeprecated'),
30+
}),
31+
2932
'route-name': null,
3033
'show-private': false,
3134
'show-protected': false,

app/components/instance-item.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ import Ember from "ember";
22
import HasWaypoint from "../mixins/views/has-waypoint";
33
import config from '../config/environment';
44

5-
const { alias } = Ember.computed;
6-
const { Component, get } = Ember;
5+
const { Component, get, computed: { alias } } = Ember;
76

87
export default Component.extend(HasWaypoint, {
98
/*
@@ -15,9 +14,9 @@ export default Component.extend(HasWaypoint, {
1514
itemType: null,
1615
name: alias('item.name'),
1716
routeName: null,
18-
id: function(){
17+
id: computed('item.name', 'itemType', function() {
1918
return "%@_%@".fmt(get(this, 'itemType'), get(this, 'item.name'));
20-
}.property('item.name', 'itemType').readOnly(),
19+
}).readOnly(),
2120
isPrivate: alias('item.isPrivate'),
2221
classNames: ['property', 'item-entry'],
2322
classNameBindings: ['isPrivate:private'],
@@ -40,16 +39,17 @@ export default Component.extend(HasWaypoint, {
4039
router.replaceWith(routeName, name);
4140
},
4241

43-
isVisible: function() {
42+
isVisible: computed('show-private', 'show-protected', 'show-deprecated',
43+
'show-inherited', 'item.isPrivate', 'item.isProtected',
44+
'item.inheritedFrom', 'item.isDeprecated',
45+
function() {
4446
if (get(this, 'item.isPrivate') && !get(this, 'show-private')) { return false; }
4547
if (get(this, 'item.inheritedFrom') && !get(this, 'show-inherited')) { return false; }
4648
if (get(this, 'item.isProtected') && !get(this, 'show-protected')) { return false; }
4749
if (get(this, 'item.isDeprecated') && !get(this, 'show-deprecated')){ return false; }
4850

4951
return true;
50-
}.property('show-private', 'show-protected', 'show-deprecated',
51-
'show-inherited', 'item.isPrivate', 'item.isProtected',
52-
'item.inheritedFrom', 'item.isDeprecated'),
52+
}),
5353
/**
5454
The URL where you cand find the code for this property on github.
5555
TODO: don't link to blob/master,
@@ -58,7 +58,7 @@ export default Component.extend(HasWaypoint, {
5858
5959
@returns String
6060
*/
61-
codeLocation: function() {
61+
codeLocation: computed('item.file', 'item.line', function() {
6262
return '%@/blob/%@/%@#L%@'.fmt(config.githubUrl, config.sha, get(this, 'item.file'), get(this, 'item.line'));
63-
}.property('item.file', 'item.line').readOnly()
63+
}).readOnly()
6464
});

0 commit comments

Comments
 (0)