makeFindOne
can.Model.makeFindOne: function(findOneData) -> findOne
Returns the external findOne method given the implemented findOneData function.
Parameters
-
{findOneData(params)}findOne is implemented with a
String, ajax settings object, or findOneData function. If it is implemented as aStringor ajax settings object, those values are used to create a findOneData function.The findOneData function is passed to
makeFindOne.makeFindOneshould usefindOneDatainternally to get the raw data for the request.
Returns
{function(params, success, error)}
Returns function that implements the external API of findOne.
Use
makeFindOnecan be used to implement base models that perform special behavior.makeFindOneis passed a findOneData function that retrieves raw data. It should return a function that when called, uses the findOneData function to get the raw data, convert them to model instances with models.Caching
The following uses
makeFindOneto create a baseCachedModel:The following Todo model will never request the same todo twice: