Skip to content

Simplify ValueFormatter interface, remove ValueFormatterStore #93

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 13, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 2 additions & 22 deletions src/valueFormatters/formatters/ValueFormatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,44 +10,24 @@
* @author H. Snater < mediawiki@snater.com >
*
* @constructor
*
* @param {Object} options
*/
var SELF = vf.ValueFormatter = function VpValueFormatter( options ) {
this._options = $.extend( {}, options || {} );
var SELF = vf.ValueFormatter = function VpValueFormatter() {
};

/**
* @class valueFormatters.ValueFormatter
*/
$.extend( SELF.prototype, {
/**
* Formatter options.
* @property {Object}
* @private
*/
_options: null,

/**
* Returns the formatter's options as set in the constructor.
*
* @return {Object}
*/
getOptions: function() {
return $.extend( {}, this._options );
},

/**
* Formats a value. Will return a jQuery.Promise which will be resolved if formatting is
* successful or rejected if it fails. There are various reasons why formatting could fail, e.g.
* the formatter is using the API and the API cannot be reached. In case of success, the
* the formatter is using an API and the API cannot be reached. In case of success, the
* callbacks will be passed a dataValues.DataValue object. In case of failure, the callback's
* parameter will be an error object of some sort (not implemented yet!).
* @abstract
*
* @param {dataValues.DataValue} dataValue
* @param {string} [dataTypeId]
* @param {string} [outputType] The output's preferred MIME type
* @return {Object} jQuery.Promise
* @return {Function} return.done
* @return {string|null} return.done.formatted Formatted DataValue.
Expand Down