Skip to main content
Module

x/tui/mod.ts>Effect

🦕 Deno module for creating Terminal User Interfaces
Go to Latest
class Effect
implements Dependant
Re-export
import { Effect } from "https://deno.land/x/tui@2.0.0/mod.ts";

Effect is an container for callback function, which runs every time any of its dependencies get updated.

When initialized that functions gets ran and all dependencies for it are tracked.

Examples

Example 1

const name = new Signal("Jonathan");
const effect = new Effect(() => {
 console.log("Your name is", name)
});
// printed: "Your name is Jonathan"

name.value = "Brian";
// printed: "Your name is Brian"

Constructors

new
Effect(effectable: Effectable)

Properties

dependencies: Set<Dependency>
update: Effectable

Methods

dispose(): void
  • Removes itself from all dependencies dependants
  • Clears dependencies