Skip to content
Gentilhomme edited this page Jul 26, 2016 · 10 revisions

Chunk

Chunks are used to manage global variables and reseatable variables in the most case. Chunks also offer object-oriented automatic & intelligent implementation with others components.

Warning : Do not use Chunk to replace behavior properties (this is a wrong solution).

Example

interface IPlayer {
    name: string;
    exp: number;
    level: number;
}
const Player : United.Collections.Chunk<IPlayer> = new United.Collections.Chunk<IPlayer>({
    name: "fraxken",
    exp: 0,
    level: 0
});
Sup.log(Player.$.name); // log fraxken
Player.$.level = 10; // Set level to 10
Player.resetVar("level"); // Reset level to the original value : 0
Player.resetAll(); // Reset all variables of player chunk.

Class methodes

Constructor with no argument.

constructor()

Unstable method. Do not use !

public set authentification(value: boolean)

Clear the entiere chunk.

clear() : boolean

Clone the chunk.

clone() : United.Collections.Chunk<T>

declare new variables (any or linked to the interface).

declare(Object: I) : boolean

remove one or multiple variables from the chunk.

remove(varName: string | string[])

know if the chunk have a variable

has(varName: string) : boolean

Reset specific variable.

resetVar(varName: string) : boolean

Reset all variables

resetAll() : void

Rename a variable !

rename(varName: string,newName: string) : boolean

Roadmap

  • Observable & intelligent mapping functions integration.
Clone this wiki locally