2.0 Beta

Smootify 2.0 is in public beta. Your 1.x store keeps working. Move when you want.

What changed

Smootify.once()

The once method of window.Smootify.

v2.0 beta
Open .md
On this page
  1. Types
  2. SmootifyEventName
  3. SmootifyShortEventName
  4. SmootifyEventHandler

New in 2.0.

once<N extends SmootifyEventName | SmootifyShortEventName>( name: N, handler: SmootifyEventHandler<N>, ): () => void

Types

SmootifyEventName

export type SmootifyEventName = keyof SmootifyEventMap;

SmootifyShortEventName

/** A `smootify:` event by its name alone: `cart_updated`, `wishlist:changed_product`. */
export type SmootifyShortEventName = {
  [K in SmootifyEventName]: K extends `smootify:${infer Short}` ? Short : never;
}[SmootifyEventName];

SmootifyEventHandler

export type SmootifyEventHandler<N extends SmootifyEventName | SmootifyShortEventName> = (
  payload: SmootifyEventMap[FullEventName<N>],
) => void;

    ↑ ↓ to moveEnter to openEsc to close