https://www.mediawiki.org/wiki/Special:Code/MediaWiki/102046

Revision: 102046
Author:   tparscal
Date:     2011-11-04 21:06:06 +0000 (Fri, 04 Nov 2011)
Log Message:
-----------
Added documentation for es.Transaction

Modified Paths:
--------------
    trunk/extensions/VisualEditor/modules/es/es.Transaction.js

Modified: trunk/extensions/VisualEditor/modules/es/es.Transaction.js
===================================================================
--- trunk/extensions/VisualEditor/modules/es/es.Transaction.js  2011-11-04 
20:46:04 UTC (rev 102045)
+++ trunk/extensions/VisualEditor/modules/es/es.Transaction.js  2011-11-04 
21:06:06 UTC (rev 102046)
@@ -11,10 +11,21 @@
 
 /* Methods */
 
+/**
+ * Gets a list of all operations.
+ * 
+ * @method
+ * @returns {Object[]} List of operations
+ */
 es.Transaction.prototype.getOperations = function() {
        return this.operations; 
 };
 
+/**
+ * Merges consecutive operations of the same type.
+ * 
+ * @method
+ */
 es.Transaction.prototype.optimize = function() {
        for ( var i = 0; i < this.operations.length - 1; i++ ) {
                var a = this.operations[i];
@@ -35,6 +46,12 @@
        }
 };
 
+/**
+ * Adds a retain operation.
+ * 
+ * @method
+ * @param {Integer} length Length of content data to retain
+ */
 es.Transaction.prototype.pushRetain = function( length ) {
        this.operations.push( {
                'type': 'retain',
@@ -42,13 +59,25 @@
        } );
 };
 
-es.Transaction.prototype.pushInsert = function( content ) {
+/**
+ * Adds an insertion operation.
+ * 
+ * @method
+ * @param {Array} data Data to retain
+ */
+es.Transaction.prototype.pushInsert = function( data ) {
        this.operations.push( {
                'type': 'insert',
-               'data': content
+               'data': data
        } );
 };
 
+/**
+ * Adds a removal operation.
+ * 
+ * @method
+ * @param {Array} data Data to remove
+ */
 es.Transaction.prototype.pushRemove = function( data ) {
        this.operations.push( {
                'type': 'remove',
@@ -56,6 +85,14 @@
        } );
 };
 
+/**
+ * Adds an element attribute change operation.
+ * 
+ * @method
+ * @param {String} method Method to use, either "set" or "clear"
+ * @param {String} key Name of attribute to change
+ * @param {Mixed} value Value to set attribute to, or value of attribute being 
cleared
+ */
 es.Transaction.prototype.pushChangeElementAttribute = function( method, key, 
value ) {
        this.operations.push( {
                'type': 'attribute',
@@ -65,6 +102,13 @@
        } );
 };
 
+/**
+ * Adds a start annotating operation.
+ * 
+ * @method
+ * @param {String} method Method to use, either "set" or "clear"
+ * @param {Object} annotation Annotation object to start setting or clearing 
from content data
+ */
 es.Transaction.prototype.pushStartAnnotating = function( method, annotation ) {
        this.operations.push( {
                'type': 'annotate',
@@ -74,6 +118,13 @@
        } );
 };
 
+/**
+ * Adds a stop annotating operation.
+ * 
+ * @method
+ * @param {String} method Method to use, either "set" or "clear"
+ * @param {Object} annotation Annotation object to stop setting or clearing 
from content data
+ */
 es.Transaction.prototype.pushStopAnnotating = function( method, annotation ) {
        this.operations.push( {
                'type': 'annotate',


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to