Skip to content

crelte / bodyClass / BodyClass

Class: BodyClass

Constructors

Constructor

ts
new BodyClass(inner, store?): BodyClass;

Parameters

inner

PlatformBodyClass

store?

StagedWritable<void>

Returns

BodyClass

Methods

add()

ts
add(...classes): void;

Adds the given classes to the body

Parameters

classes

...string[]

Returns

void


contains()

ts
contains(cls): boolean;

Checks if the body contains the given class

Parameters

cls

string

Returns

boolean


remove()

ts
remove(...classes): void;

Parameters

classes

...string[]

Returns

void


subscribe()

ts
subscribe(fn, invalidate?): () => void;

Parameters

fn

(val) => void

invalidate?

() => void

Returns

ts
(): void;
Returns

void


toggle()

ts
toggle(cls, force?): void;

Toggles the given class on the body

Warning

toggle without force should almost never be used on the server. If you call this for example in loadData the server will add the class and the client will the remove it.

Parameters

cls

string

force?

boolean

Returns

void