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