updateOnly

Summary

Updates the view in response to specific changes in the model.

Usage

public virtual void updateOnly(Change[] changes)

Parameters

changes

The changeset received from the model.

Description

Updates the view in response to changes in the model. Override this method in order to exercise precise control over UI updates - such as DOM diffing or individual DOM element changes.

The default implementation for this is NOP (no operation). This method needs to be overridden.

This method responds to the Model.updateOnly method.

Examples

Basic Usage
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import Altitude.Frontend;
 
class Menu : View
{
    Menu() {
        super(Templates.Menu.template);
    }
 
    override void updateOnly(Change[] changes) {
        foreach(Change change in changes) {
            if (change.key == "menu-item") {
                selectMenuItem((System.String) change.value);
                continue;
            }
        }
    }
}

Share

HTML | BBCode | Direct Link