update Method

Callable

  • Updates a channel container with new parameters.

    example
    // Initialize a product with the "card.psd" template and a channel container.
    const productDefinition = {
        surfaces: [{
            printAreas: [{
                designFile: "card",
                containers: [{
                        name: "foil",
                        texture: "texture.png",
                        type: "texture"
                    }]
            }]
        }]
    };
    
    // Load the editor.
    CustomersCanvas.IframeApi.loadEditor(iframe, productDefinition)
    
        // If the editor has been successfully loaded.
        .then(function (editor) {
            // When we get the product.
            editor.getProduct().then(function (product) {
                // Get the fourth container.
                product.currentSurface.printAreas[0].getContainers()[3]
                    // Update this container with new parameters.
                    .update({
                        name: "SilverTexture",
                        texture: "silver-texture.jpg",
                        // Expects a translated string for the SILVER key in translations.json.
                        translationKey: "ObjectInspector.SILVER"
                    });
            });
        });
    

    Parameters

    Returns Promise < this >

    An instance of the updated container.