destroy
function
Delete's the instance with the connection.
map.destroy( [success], [error] )
Parameters
- success
{function}:A function that is called if the destroy is successful.
- error
{function}:A function that is called if the destroy is rejected.
Returns
{Promise<Instance>}:
A promise that resolves to the instance is successful.
Use
var Todo = DefineMap.extend({
id: "number",
complete: "boolean",
name: "string"
});
connect([
require("can-connect/can/map/map"),
require("can-connect/constructor/constructor"),
require("can-connect/data/url/url")
],{
Map: Todo,
url: "/todos"
})
new Todo({name: "dishes"}).save(function(todo){
todo.destroy();
});