How to use the can-connect/can/base-map/ function in can-connect

To help you get started, we’ve selected a few can-connect examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github canjs / canjs / docs / can-guides / commitment / recipes / todomvc-with-steal / 15-setter-toggle / todo.js View on Github external
return todo.isSaving();
		} );
	},
	updateCompleteTo: function( value ) {
		this.forEach( function( todo ) {
			todo.complete = value;
			todo.save();
		} );
	}
} );
Todo.algebra = new set.Algebra(
	set.props.boolean( "complete" ),
	set.props.id( "id" ),
	set.props.sort( "sort" )
);
Todo.connection = connectBaseMap( {
	url: "/api/todos",
	Map: Todo,
	List: Todo.List,
	name: "todo",
	algebra: Todo.algebra
} );
export default Todo;
github canjs / canjs / docs / can-guides / commitment / recipes / todomvc-with-steal / 9-connection / todo.js View on Github external
},
	get complete() {
		return this.filter( {
			complete: true
		} );
	},
	get allComplete() {
		return this.length === this.complete.length;
	}
} );
Todo.algebra = new set.Algebra(
	set.props.boolean( "complete" ),
	set.props.id( "id" ),
	set.props.sort( "sort" )
);
Todo.connection = connectBaseMap( {
	url: "/api/todos",
	Map: Todo,
	List: Todo.List,
	name: "todo",
	algebra: Todo.algebra
} );
export default Todo;
github canjs / canjs / docs / can-guides / commitment / recipes / todomvc-with-steal / 16-clear-all-completed / todo.js View on Github external
todo.complete = value;
			todo.save();
		} );
	},
	destroyComplete: function() {
		this.complete.forEach( function( todo ) {
			todo.destroy();
		} );
	}
} );
Todo.algebra = new set.Algebra(
	set.props.boolean( "complete" ),
	set.props.id( "id" ),
	set.props.sort( "sort" )
);
Todo.connection = connectBaseMap( {
	url: "/api/todos",
	Map: Todo,
	List: Todo.List,
	name: "todo",
	algebra: Todo.algebra
} );
export default Todo;