ZPT-JS reference - Configuration - dictionaryChanges

Syntax

dictionaryChanges ::= a javascript object
                

Description

The dictionaryChanges is used to declare one or more values in dictionary that must be updated. It is a javascript object. ZPT-JS will also update HTML!

Important! This configuration option must be used beside update command. It the command is not update it will be ignored.

Examples

An example of fullRender:

"use strict";

var zpt = require( 'zpt' );

var dictionary = {
    aString: "string",
    doggy: false,
    number: 23,
    user: {
        name: "Bob", 
        age: function( ){
            return 25;
        }
    },
    items: [ "item0", "item1", "item2" ]
};

// Parse template
zpt.run({
    root: document.body,
    dictionary: dictionary
});

[ your code here ]

// Second execution: update the DOM, the user and the number have changed
zpt.run({
    command: "update",
    dictionaryChanges: {
        number: 30,
        user: {
            name: "Kermit", 
            age: function( ){
                return 45;
            }
        }
    }
});