-
Notifications
You must be signed in to change notification settings - Fork 0
/
sc-view-class.sublime-snippet
46 lines (35 loc) · 1.06 KB
/
sc-view-class.sublime-snippet
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<snippet>
<content><![CDATA[SC.View.extend(
/** @scope ${5:MyApp.MyView}.prototype */ {
// ---------------------------------------------------------------------------
// Properties
//
classNames: ['${10}'],
displayProperties: ['${15:isSelected}'],
${15:isSelected}: false,
// ---------------------------------------------------------------------------
// Methods
//
// ---------------------------------------------------------------------------
// Render/Update
//
/** @private */
render: function (context) {
var ${15:isSelected} = this.get('${15:isSelected}');
// Set the 'sel' class if `${15:isSelected}` is true.
context.setClass({
'sel': ${15:isSelected}
});
},
/** @private */
update: function (jqElement) {
var ${15:isSelected} = this.get('${15:isSelected}');
// Update the 'sel' class.
jqElement.toggleClass('sel', ${15:isSelected});
}
});
]]></content>
<tabTrigger>SCView</tabTrigger>
<scope>source.js</scope>
<description>SC.View.extend({ … (Class)</description>
</snippet>