Setting the material of an entity created by scripts

I have created a cone with scripts but it has no material. What is the code for setting its material?

Code that creates a cone on mouseclick:

var Camera = pc.createScript('camera');
var entity1 = new pc.Entity();

        type: "cone",

Camera.prototype.initialize = function() {'mousedown', this.onMouseDown, this);

Camera.prototype.onMouseDown = function(event) {;