Change

Summary

Represents an individual change.

Description

Represents an individual change.

Examples

Basic Usage
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import Altitude.Frontend;
 
class LoginModel : Model
{
    public void validateEmail(string email) {
        bool result = isEmail(email);
        this.updateOnly([ new Change("validate-email", result) ]);
    }
}
 
class LoginView : View
{
    public override void updateOnly(Change[] changes) {
        var $email = $(".login input[type=email]");
 
        foreach(Change change in changes) {
            if (change.key == "validate-email") {
                bool isValidEmail = (System.Boolean) change.value;
                if (isValidEmail) {
                    $email.removeClass("invalid");
                }
                else {
                    $email.addClass("invalid");
                }
            }
        }
    }
}

Methods

  • Change (Constructor)

    Constructs an object representing an individual change.

  • key

    Gets the unique key for identifying the change type.

  • value

    Gets the value associated with a unique key for identifying the change type.

Share

HTML | BBCode | Direct Link