Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitee44489

Browse files
committed
Use ES6 shorthand syntax when constructing objects
Change-Id: Id3031bd1d324b1ad974093cb8e75a463605fe741
1 parent4e0a348 commitee44489

File tree

86 files changed

+276
-326
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+276
-326
lines changed

‎collab/ve.dm.CollabTransportServer.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ ve.dm.CollabTransportServer = function VeDmCollabTransportServer( startHeight )
1717
this.startHeight=startHeight;
1818
this.protocolServer=newve.dm.ProtocolServer(
1919
{
20-
startHeight:startHeight,
20+
startHeight,
2121
// The server ID is arbitrary
2222
serverId:'ve-collab-server',
2323
load:function(){
@@ -58,12 +58,12 @@ ve.dm.CollabTransportServer.prototype.onConnection = function ( conn ) {
5858
context.broadcast=function(type,data){
5959
constserialized=ve.collab.serialize(data);
6060
connections.forEach((connection)=>{
61-
connection.send({type:type,data:serialized});
61+
connection.send({ type,data:serialized});
6262
});
6363
};
6464
context.sendAuthor=function(type,data){
6565
constserialized=ve.collab.serialize(data);
66-
conn.send({type:type,data:serialized});
66+
conn.send({ type,data:serialized});
6767
};
6868
conn.on('data',(data)=>{
6969
consttype=data.type;

‎demos/ve/ve.demo.SurfaceContainer.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ ve.demo.SurfaceContainer.prototype.loadHtml = function ( pageHtml, mode, skipAut
308308
mode,
309309
{lang:this.lang,dir:this.dir}
310310
),
311-
{placeholder:'Start your document',mode:mode}
311+
{placeholder:'Start your document', mode}
312312
);
313313

314314
this.target.setSurface(this.surface);

‎rebaser/src/app.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function initApp( options ) {
3434
// eslint-disable-next-line prefer-regex-literals
3535
app.get(newRegExp('/doc/edit/(.*)'),(req,res)=>{
3636
constdocName=req.params[0];
37-
res.render('editor',{docName:docName});
37+
res.render('editor',{ docName});
3838
});
3939

4040
// eslint-disable-next-line prefer-regex-literals

‎rebaser/src/dm/ve.dm.DocumentStore.js‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@ ve.dm.DocumentStore.prototype.dropDatabase = function () {
6060
ve.dm.DocumentStore.prototype.load=function(docName){
6161
constdocumentStore=this;
6262
returnthis.collection.findOneAndUpdate(
63-
{docName:docName},
63+
{ docName},
6464
{$setOnInsert:{start:0,transactions:[],stores:[]}},
6565
{upsert:true,returnDocument:'after'}
6666
).then((result)=>{
6767
constlength=result.value.transactions.length||0;
68-
documentStore.logger.logServerEvent({type:'DocumentStore#loaded',docName:docName,length:length});
68+
documentStore.logger.logServerEvent({type:'DocumentStore#loaded', docName, length});
6969
documentStore.startForDoc.set(docName,result.value.start+length);
7070
returnve.dm.Change.static.deserialize({
7171
start:0,
@@ -92,7 +92,7 @@ ve.dm.DocumentStore.prototype.onNewChange = function ( docName, change ) {
9292
}
9393
this.startForDoc.set(docName,serializedChange.start+serializedChange.transactions.length);
9494
returnthis.collection.updateOne(
95-
{docName:docName},
95+
{ docName},
9696
{
9797
$push:{
9898
transactions:{$each:serializedChange.transactions},
@@ -102,7 +102,7 @@ ve.dm.DocumentStore.prototype.onNewChange = function ( docName, change ) {
102102
).then(()=>{
103103
this.logger.logServerEvent({
104104
type:'DocumentStore#onNewChange',
105-
docName:docName,
105+
docName,
106106
start:serializedChange.start,
107107
length:serializedChange.transactions.length
108108
});

‎rebaser/src/dm/ve.dm.ProtocolServer.js‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ ve.dm.ProtocolServer.prototype.ensureLoaded = function ( docName ) {
4949
if(loading){
5050
returnloading;
5151
}
52-
this.logger.logServerEvent({type:'ProtocolServer#load',docName:docName});
52+
this.logger.logServerEvent({type:'ProtocolServer#load', docName});
5353
loading=this.documentStore.load(docName).then((change)=>{
5454
this.logger.logServerEvent({
5555
type:'ProtocolServer#loaded',
56-
docName:docName,
56+
docName,
5757
length:change.getLength()
5858
});
5959
rebaseServer.updateDocState(docName,null,change);
@@ -84,8 +84,8 @@ ve.dm.ProtocolServer.prototype.authenticate = function ( docName, authorId, toke
8484
}
8585
constcontext={
8686
serverId:this.documentStore.serverId,
87-
docName:docName,
88-
authorId:authorId
87+
docName,
88+
authorId
8989
};
9090
this.logger.logServerEvent({
9191
type:'newClient',
@@ -136,12 +136,12 @@ ve.dm.ProtocolServer.prototype.welcomeClient = function ( context, startLength =
136136
constauthorData=state.authors.get(authorId);
137137

138138
context.sendAuthor('registered',{
139-
serverId:serverId,
140-
authorId:authorId,
139+
serverId,
140+
authorId,
141141
token:authorData.token
142142
});
143143
context.broadcast('authorChange',{
144-
authorId:authorId,
144+
authorId,
145145
authorData:{
146146
name:authorData.name,
147147
color:authorData.color

‎rebaser/src/dm/ve.dm.RebaseServer.js‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ ve.dm.RebaseServer.prototype.applyChange = function applyChange( doc, authorId,
103103
if(rejections>backtrack){
104104
// Follow-on does not fully acknowledge outstanding conflicts: reject entirely
105105
rejections=rejections-backtrack+change.transactions.length;
106-
this.updateDocState(doc,authorId,null,{rejections:rejections});
106+
this.updateDocState(doc,authorId,null,{ rejections});
107107
// FIXME argh this publishes an empty change, which is not what we want
108108
appliedChange=state.history.truncate(0);
109109
}elseif(rejections<backtrack){
@@ -121,19 +121,19 @@ ve.dm.RebaseServer.prototype.applyChange = function applyChange( doc, authorId,
121121
constresult=ve.dm.Change.static.rebaseUncommittedChange(base,change);
122122
rejections=result.rejected ?result.rejected.getLength() :0;
123123
this.updateDocState(doc,authorId,result.rebased,{
124-
rejections:rejections,
124+
rejections,
125125
continueBase:result.transposedHistory
126126
});
127127
appliedChange=result.rebased;
128128
}
129129
this.logEvent({
130130
type:'applyChange',
131-
doc:doc,
132-
authorId:authorId,
131+
doc,
132+
authorId,
133133
incoming:change,
134134
applied:appliedChange,
135-
backtrack:backtrack,
136-
rejections:rejections
135+
backtrack,
136+
rejections
137137
});
138138
returnappliedChange;
139139
};

‎rebaser/src/logToTestCase.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ function toTestCase( parsedLog ) {
7575
}
7676
return{
7777
initialData:[],
78-
clients:clients,
79-
ops:ops
78+
clients,
79+
ops
8080
};
8181
}
8282

‎src/ce/selections/ve.ce.TableSelection.js‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ ve.ce.TableSelection.prototype.getSelectionBoundingRect = function () {
8383
}
8484

8585
constboundingRect={
86-
top:top,
87-
bottom:bottom,
88-
left:left,
89-
right:right,
86+
top,
87+
bottom,
88+
left,
89+
right,
9090
width:right-left,
9191
height:bottom-top
9292
};

‎src/ce/ve.ce.ClipboardHandler.js‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ ve.ce.ClipboardHandler.prototype.onCopy = function ( e, selection ) {
221221

222222
this.clipboardIndex++;
223223
constclipboardKey=this.clipboardId+'-'+this.clipboardIndex;
224-
this.clipboard={slice:slice,hash:null};
224+
this.clipboard={ slice,hash:null};
225225
// Support: Firefox<48
226226
// Writing a custom clipboard key won't work in Firefox<48, so write
227227
// it to the HTML instead
@@ -548,7 +548,7 @@ ve.ce.ClipboardHandler.prototype.afterPaste = function () {
548548

549549
surface.emit('paste',{
550550
source:beforePasteData.source,
551-
fragment:fragment
551+
fragment
552552
});
553553
});
554554
};
@@ -616,9 +616,9 @@ ve.ce.ClipboardHandler.prototype.afterPasteExtractClipboardData = function () {
616616
}
617617

618618
return{
619-
clipboardKey:clipboardKey,
620-
$clipboardHtml:$clipboardHtml,
621-
slice:slice
619+
clipboardKey,
620+
$clipboardHtml,
621+
slice
622622
};
623623
};
624624

‎src/ce/ve.ce.Document.js‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ ve.ce.Document.prototype.getNodeAndOffset = function ( offset ) {
151151
}
152152
node=ceChild.$element[0];
153153
if(node){
154-
return{node:node,offset:0};
154+
return{ node,offset:0};
155155
}
156156
// Else ceChild has no DOM representation; step forwards
157157
break;
@@ -166,10 +166,10 @@ ve.ce.Document.prototype.getNodeAndOffset = function ( offset ) {
166166
}
167167
if(!ceChild||!ceChild.$element[0]){
168168
// Offset lies just at the end of branchNode
169-
return{node:node,offset:node.childNodes.length};
169+
return{ node,offset:node.childNodes.length};
170170
}
171171
return{
172-
node:node,
172+
node,
173173
offset:Array.prototype.indexOf.call(
174174
node.childNodes,
175175
ceChild.$element[0]
@@ -194,7 +194,7 @@ ve.ce.Document.prototype.getNodeAndOffset = function ( offset ) {
194194
position,
195195
1,
196196
{
197-
noDescend:noDescend,
197+
noDescend,
198198
stop:function(){
199199
returntrue;
200200
}
@@ -213,12 +213,12 @@ ve.ce.Document.prototype.getNodeAndOffset = function ( offset ) {
213213
// TODO: what about zero-length text nodes?
214214
if(offset<=count+node.data.length){
215215
// Match the appropriate offset in the text node
216-
position={node:node,offset:offset-count};
216+
position={ node,offset:offset-count};
217217
break;
218218
}else{
219219
// Skip over the text node
220220
count+=node.data.length;
221-
position={node:node,offset:node.data.length};
221+
position={ node,offset:node.data.length};
222222
continue;
223223
}
224224
}// else it is an element node (TODO: handle comment etc)
@@ -257,7 +257,7 @@ ve.ce.Document.prototype.getNodeAndOffset = function ( offset ) {
257257
}elseif(step.type==='cross'){
258258
if(offset===count+1){
259259
// The offset lies inside the crossed node
260-
position={node:node,offset:0};
260+
position={ node,offset:0};
261261
break;
262262
}
263263
count+=2;
@@ -303,7 +303,7 @@ ve.ce.Document.prototype.getNodeAndOffset = function ( offset ) {
303303
}
304304
returnfalse;
305305
}
306-
ve.adjacentDomPosition(position,1,{stop:stop,noDescend:noDescend}).steps
306+
ve.adjacentDomPosition(position,1,{ stop, noDescend}).steps
307307
.slice(0,-1)
308308
.forEach((s)=>{
309309
if(s.node.nodeType===Node.TEXT_NODE){

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp