Namespace controller.formatters
- Defined in: base_controller.js
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
Contains the static methods for returning data in a specific
format.
|
Method Summary
| Method Attributes | Method Name and Description |
|---|---|
| <static> |
controller.formatters.js(content, [controller])
Formats an object as JSONP, by looking for toJson/toJSON methds
defined on it, and then falling back to JSON.stringify, and wrapping it in a
callback.
|
| <static> |
controller.formatters.json(content)
JSON-formats an object, by looking for toJson/toJSON methds
defined on it, and then falling back to JSON.stringify.
|
| <static> |
controller.formatters.txt(content)
Formats an object as plaintext, by looking for a toString
defined on it, and then falling back to JSON.stringify.
|
Namespace Detail
controller.formatters
Contains the static methods for returning data in a specific
format.
Method Detail
-
<static> controller.formatters.js(content, [controller])Formats an object as JSONP, by looking for toJson/toJSON methds defined on it, and then falling back to JSON.stringify, and wrapping it in a callback.
- Parameters:
- {Object|String} content
- The content to be formatted.
- {controller.BaseController} controller Optional
- The controller handling the response to be formatted.
-
<static> controller.formatters.json(content)JSON-formats an object, by looking for toJson/toJSON methds defined on it, and then falling back to JSON.stringify.
- Parameters:
- {Object|String} content
- The content to be formatted.
-
<static> controller.formatters.txt(content)Formats an object as plaintext, by looking for a toString defined on it, and then falling back to JSON.stringify.
- Parameters:
- {Object|String} content
- The content to be formatted.