]> code.delx.au - gnu-emacs-elpa/blob - NEWS.md
Add top-level heading
[gnu-emacs-elpa] / NEWS.md
1 # History of user-visible changes
2
3 ## 20141115
4
5 Support for:
6
7 * Unicode characters in identifiers (improved).
8 * [Delegating yield](http://wiki.ecmascript.org/doku.php?id=harmony:generators#delegating_yield).
9 * [ES6 numeric literals](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-literals-numeric-literals) (octal, binary).
10 * Harmony [array and generator comprehensions](http://wingolog.org/archives/2014/03/07/es6-generator-and-array-comprehensions-in-spidermonkey).
11
12 ## 20131106
13
14 Support for:
15
16 * [Arrow functions](http://wiki.ecmascript.org/doku.php?id=harmony:arrow_function_syntax)
17 * [Generators](http://wiki.ecmascript.org/doku.php?id=harmony:generators)
18 * [Spread operator](http://wiki.ecmascript.org/doku.php?id=harmony:spread)
19
20 ## 20130510
21
22 ### Support for JSLint global declaration
23
24 See the docstring for `js2-include-jslint-globals`.
25
26 ## 20130216
27
28 ### We don't rebind `RET` anymore
29
30 Because well-behaving major modes aren't supposed to do that.
31
32 So pressing it won't continue a block comment, or turn a string into a concatenation.
33 Pressing `M-j`, however, will.
34
35 The options `js2-indent-on-enter-key` and `js2-enter-indents-newline` were also removed.
36
37 To bring back the previous behavior, put this in your init file:
38
39 (eval-after-load 'js2-mode
40 '(define-key js2-mode-map (kbd "RET") 'js2-line-break))
41
42 ## 20120617
43
44 ### Support for [default](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/default_parameters) and [rest](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/rest_parameters) parameters
45
46 ## 20120614
47
48 ### Support for [for..of loops](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of)
49
50 ## Older changes
51
52 ### Popular indentation style
53
54 [foo, bar, baz].forEach(function (v) {
55 if (validate(v))
56 process(v);
57 });
58
59 [a, b, c].some(function (v) {
60 return validate(v);
61 });
62
63 ### Pretty multiline variable declaration
64
65 In the original mode,
66
67 var foo = 10,
68 bar = 20,
69 baz = 30;
70
71 In this mode when the value of `js2-pretty-multiline-declarations` is non-nil,
72
73 var foo = 10,
74 bar = 20,
75 baz = 30;
76
77 ### Abbreviated destructuring assignments
78
79 let {a, b} = {a: 10, b: 20}; // Abbreviated (Not supported in the original mode)
80 let {a: a, b: b} = {a: 10, b: 20}; // Same as above (Supported in the original mode)
81
82 (function ({responseText}) { /* */ })(xhr); // As the argument of function
83
84 for (let [k, { name, age }] in Iterator(obj)) // nested
85 print(k, name, age);
86
87 ### Expression closure in property value
88
89 let worker = {
90 get age() 20,
91 get sex() "male",
92 fire: function () _fire()
93 };
94
95 ### Fix for odd indentation of "else if" with no braces
96
97 In the original mode,
98
99 if (foo)
100 return foo;
101 else if (bar)
102 return bar; // here
103
104 In this mode,
105
106 if (foo)
107 return foo;
108 else if (bar)
109 return bar; // fixed
110
111 ### Imenu support for function nesting
112
113 Supports function nesting and anonymous wrappers:
114
115 (function() {
116 var foo = function() {
117 function bar() { // shown as foo.bar.<definition-1>
118 function baz() {} // foo.bar.baz
119 var qux = function() {}; // foo.bar.quux
120 }
121 };
122 });
123
124 Examples of output:
125
126 * [jQuery 1.5](https://gist.github.com/845449)
127 * [Underscore.js](https://gist.github.com/824262)
128 * [Backbone.js](https://gist.github.com/824260)
129
130 For library-specific extension methods like `$.extend` and `dojo.declare`, see [js2-imenu-extras](/mooz/js2-mode/blob/master/js2-imenu-extras.el).
131
132 ### Undeclared/external variables highlighting
133
134 Original mode highlights them only on the left side of assignments:
135
136 var house;
137 hose = new House(); // highlights "hose"
138
139 Here they are highlighted in all expressions:
140
141 function feed(fishes, food) {
142 for each (var fish in fshes) { // highlights "fshes"
143 food.feed(fsh); // highlights "fsh"
144 }
145 hood.discard(); // highlights "hood"
146 }
147
148 Destructuring assignments and array comprehensions (JS 1.7) are supported:
149
150 let three, [one, two] = [1, 2];
151 thee = one + two; // highlights "thee"
152
153 function revenue(goods) {
154 // highlights "coast"
155 return [price - coast for each ({price, cost} in goods)].reduce(add);
156 }