@@ -30,8 +30,8 @@ export class ExampleDocModel implements DocumentRegistry.IModel {
30
30
/**
31
31
* Construct a new ExampleDocModel.
32
32
*
33
- * @param languagePreference
34
- * @param modelDB
33
+ * @param languagePreference Language
34
+ * @param modelDB Document model database
35
35
*/
36
36
constructor ( languagePreference ?: string , modelDB ?: IModelDB ) {
37
37
this . modelDB = modelDB || new ModelDB ( ) ;
@@ -44,6 +44,8 @@ export class ExampleDocModel implements DocumentRegistry.IModel {
44
44
/**
45
45
* get/set the dirty attribute to know when the
46
46
* content in the document differs from disk
47
+ *
48
+ * @returns dirty attribute
47
49
*/
48
50
get dirty ( ) : boolean {
49
51
return this . _dirty ;
@@ -55,6 +57,8 @@ export class ExampleDocModel implements DocumentRegistry.IModel {
55
57
/**
56
58
* get/set the readOnly attribute to know whether this model
57
59
* is read only or not
60
+ *
61
+ * @returns readOnly attribute
58
62
*/
59
63
get readOnly ( ) : boolean {
60
64
return this . _readOnly ;
@@ -66,6 +70,8 @@ export class ExampleDocModel implements DocumentRegistry.IModel {
66
70
/**
67
71
* get the isDisposed attribute to know whether this model
68
72
* has been disposed or not
73
+ *
74
+ * @returns Model status
69
75
*/
70
76
get isDisposed ( ) : boolean {
71
77
return this . _isDisposed ;
@@ -77,6 +83,8 @@ export class ExampleDocModel implements DocumentRegistry.IModel {
77
83
*
78
84
* NOTE: The content refers to de data stored in the model while the state refers
79
85
* to the metadata or attributes of the model.
86
+ *
87
+ * @returns The signal
80
88
*/
81
89
get contentChanged ( ) : ISignal < this, void > {
82
90
return this . _contentChanged ;
@@ -88,6 +96,8 @@ export class ExampleDocModel implements DocumentRegistry.IModel {
88
96
*
89
97
* NOTE: The content refers to de data stored in the model while the state refers
90
98
* to the metadata or attributes of the model.
99
+ *
100
+ * @returns The signal
91
101
*/
92
102
get stateChanged ( ) : ISignal < this, IChangedArgs < any , any , string > > {
93
103
return this . _stateChanged ;
@@ -96,6 +106,8 @@ export class ExampleDocModel implements DocumentRegistry.IModel {
96
106
/**
97
107
* get the signal sharedModelChanged to listen for changes on the content
98
108
* of the shared model.
109
+ *
110
+ * @returns The signal
99
111
*/
100
112
get sharedModelChanged ( ) : ISignal < this, ExampleDocChange > {
101
113
return this . _sharedModelChanged ;
@@ -104,6 +116,8 @@ export class ExampleDocModel implements DocumentRegistry.IModel {
104
116
/**
105
117
* get the signal clientChanged to listen for changes on the clients sharing
106
118
* the same document.
119
+ *
120
+ * @returns The signal
107
121
*/
108
122
get clientChanged ( ) : ISignal < this, Map < number , any > > {
109
123
return this . _clientChanged ;
@@ -144,6 +158,8 @@ export class ExampleDocModel implements DocumentRegistry.IModel {
144
158
* Should return the data that you need to store in disk as a string.
145
159
* The context will call this method to get the file's content and save it
146
160
* to disk
161
+ *
162
+ * @returns The data
147
163
*/
148
164
toString ( ) : string {
149
165
const pos = this . sharedModel . getContent ( 'position' ) ;
@@ -160,7 +176,7 @@ export class ExampleDocModel implements DocumentRegistry.IModel {
160
176
* This method should implement the logic to parse the data and store it
161
177
* on the datastore.
162
178
*
163
- * @param data
179
+ * @param data Serialized data
164
180
*/
165
181
fromString ( data : string ) : void {
166
182
const obj = JSON . parse ( data ) ;
@@ -177,6 +193,8 @@ export class ExampleDocModel implements DocumentRegistry.IModel {
177
193
*
178
194
* NOTE: This method is only used by the context of the notebook, every other
179
195
* document will load/save the data through toString/fromString.
196
+ *
197
+ * @returns Model JSON representation
180
198
*/
181
199
toJSON ( ) : PartialJSONObject {
182
200
const pos = this . sharedModel . getContent ( 'position' ) ;
@@ -196,7 +214,7 @@ export class ExampleDocModel implements DocumentRegistry.IModel {
196
214
* NOTE: This method is only used by the context of the notebook, every other
197
215
* document will load/save the data through toString/fromString.
198
216
*
199
- * @param data
217
+ * @param data Serialized model
200
218
*/
201
219
fromJSON ( data : PartialJSONObject ) : void {
202
220
this . sharedModel . transact ( ( ) => {
@@ -236,7 +254,7 @@ export class ExampleDocModel implements DocumentRegistry.IModel {
236
254
/**
237
255
* Sets the position of the SharedObject
238
256
*
239
- * @param pos
257
+ * @param pos Position
240
258
*/
241
259
setPosition ( pos : Position ) : void {
242
260
this . sharedModel . setContent ( 'position' , pos ) ;
@@ -245,7 +263,7 @@ export class ExampleDocModel implements DocumentRegistry.IModel {
245
263
/**
246
264
* Sets the text inside the SharedObject
247
265
*
248
- * @param content
266
+ * @param content Text
249
267
*/
250
268
setContent ( content : string ) : void {
251
269
this . sharedModel . setContent ( 'content' , content ) ;
@@ -254,7 +272,7 @@ export class ExampleDocModel implements DocumentRegistry.IModel {
254
272
/**
255
273
* Sets the mouse's position of the client
256
274
*
257
- * @param pos
275
+ * @param pos Mouse position
258
276
*/
259
277
setClient ( pos : Position ) : void {
260
278
// Adds the position of the mouse from the client to the shared state.
@@ -265,10 +283,8 @@ export class ExampleDocModel implements DocumentRegistry.IModel {
265
283
* Callback to listen for changes on the sharedModel. This callback listens
266
284
* to changes on shared model's content and propagates them to the DocumentWidget.
267
285
*
268
- * @param sender: The sharedModel that triggers the changes.
269
- * @param change: The changes on the sharedModel.
270
- * @param sender
271
- * @param changes
286
+ * @param sender The sharedModel that triggers the changes.
287
+ * @param changes The changes on the sharedModel.
272
288
*/
273
289
private _onSharedModelChanged = (
274
290
sender : ExampleDoc ,
@@ -281,9 +297,6 @@ export class ExampleDocModel implements DocumentRegistry.IModel {
281
297
* Callback to listen for changes on the sharedModel. This callback listens
282
298
* to changes on the different clients sharing the document and propagates
283
299
* them to the DocumentWidget.
284
- *
285
- * @param sender: The sharedModel that triggers the changes.
286
- * @param clients: The list of client's states.
287
300
*/
288
301
private _onClientChanged = ( ) => {
289
302
const clients = this . sharedModel . awareness . getStates ( ) ;
@@ -337,6 +350,8 @@ export class ExampleDoc extends YDocument<ExampleDocChange> {
337
350
338
351
/**
339
352
* Static method to create instances on the sharedModel
353
+ *
354
+ * @returns The sharedModel instance
340
355
*/
341
356
public static create ( ) : ExampleDoc {
342
357
return new ExampleDoc ( ) ;
@@ -345,8 +360,8 @@ export class ExampleDoc extends YDocument<ExampleDocChange> {
345
360
/**
346
361
* Returns an the requested object.
347
362
*
348
- * @param key: The key of the object.
349
- * @param key
363
+ * @param key The key of the object.
364
+ * @returns The content
350
365
*/
351
366
public getContent ( key : string ) : any {
352
367
return this . _content . get ( key ) ;
@@ -355,10 +370,8 @@ export class ExampleDoc extends YDocument<ExampleDocChange> {
355
370
/**
356
371
* Adds new data.
357
372
*
358
- * @param key: The key of the object.
359
- * @param value: New object.
360
- * @param key
361
- * @param value
373
+ * @param key The key of the object.
374
+ * @param value New object.
362
375
*/
363
376
public setContent ( key : string , value : any ) : void {
364
377
this . _content . set ( key , value ) ;
@@ -367,7 +380,7 @@ export class ExampleDoc extends YDocument<ExampleDocChange> {
367
380
/**
368
381
* Handle a change.
369
382
*
370
- * @param event
383
+ * @param event Model event
371
384
*/
372
385
private _contentObserver = ( event : Y . YMapEvent < any > ) : void => {
373
386
const changes : ExampleDocChange = { } ;
0 commit comments