Remove ClientFieldValidator#monitor
* src/validate/ClientFieldValidator.js (monitor): Remove This just concerns itself with something that it should be concerned about; let the caller handle monitoring, now that we have a #validate method.master
parent
0ac16a3505
commit
fefe2dae41
|
@ -17,20 +17,14 @@
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
|
||||||
* @needsLove
|
|
||||||
* - Liberate QuoteClient
|
|
||||||
* @end needsLove
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var Class = require( 'easejs' ).Class,
|
var Class = require( 'easejs' ).Class,
|
||||||
QuoteClient = require( 'program/QuoteClient' ),
|
|
||||||
EventEmitter = require( 'events' ).EventEmitter;
|
EventEmitter = require( 'events' ).EventEmitter;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Passively monitors quote data, validating and formatting any fields that are
|
* Validate and format altered fields
|
||||||
* altered for the given QuoteClient
|
|
||||||
*
|
*
|
||||||
* In the event of a validation failure, the data will not be added to the
|
* In the event of a validation failure, the data will not be added to the
|
||||||
* bucket and the caller may be notified via a failure callback. This way, you
|
* bucket and the caller may be notified via a failure callback. This way, you
|
||||||
|
@ -64,34 +58,6 @@ module.exports = Class( 'ClientFieldValidator' )
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Monitor the given QUOTE_CLIENT for field changes and trigger validation *
|
|
||||||
*
|
|
||||||
* @param {QuoteClient} quote_client quote client to validate against
|
|
||||||
*
|
|
||||||
* @param {function(Object)} failure_callback function to call with errors
|
|
||||||
* @param {function(Object)} fix_callback function to call with indexes
|
|
||||||
* of fields that have previously
|
|
||||||
* failed, but have since been
|
|
||||||
* resolved
|
|
||||||
*
|
|
||||||
* @return {ClientFieldValidator} self
|
|
||||||
*/
|
|
||||||
'public monitor': function( quote_client, failure_callback, fix_callback )
|
|
||||||
{
|
|
||||||
var _self = this;
|
|
||||||
|
|
||||||
// catch problems *before* the data is staged, altering the data
|
|
||||||
// directly if need be
|
|
||||||
quote_client.on( 'preDataUpdate', function( data )
|
|
||||||
{
|
|
||||||
_self.validate( data, failure_callback, fix_callback );
|
|
||||||
} );
|
|
||||||
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform field validation
|
* Perform field validation
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue