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();

entity1.addComponent("render", 
    {
        type: "cone",
    });

Camera.prototype.initialize = function() {
    this.app.mouse.on('mousedown', this.onMouseDown, this);
};

Camera.prototype.onMouseDown = function(event) {
    this.app.root.addChild(entity1);
};