On this page:
current-flash-messages
flash-manager?
make-flash-manager
wrap-flash
flash

10 Flash

 (require koyo/flash) package: koyo-lib

This module exposes a component for storing and retrieving flash messages. Flash messages which are set on one page, are available for on the next and then cleared as soon as the next page is processed. Each message is bound to a specific user session.

parameter

(current-flash-messages)  (listof (cons/c symbol? string?))

(current-flash-messages messages)  void?
  messages : (listof (cons/c symbol? string?))
This parameter holds the set of flash messages for the current session.

procedure

(flash-manager? v)  boolean?

  v : any/c
Returns #t when v is a flash manager.

procedure

(make-flash-manager sessions)  flash-manager?

  sessions : session-manager?
Creates a new flash manager which stores its messages using sessions.

procedure

(wrap-flash flashes)  
(-> (-> request? can-be-response?)
    (-> request? can-be-response?))
  flashes : flash-manager?
Wraps a handler such that flash messages from the previous request get collected into current-flash-messages and then cleared from the current session.

This wrapper must be applied after wrap-session.

procedure

(flash key message)  void?

  key : symbol?
  message : string?
(flash flashes key message)  void?
  flashes : flash-manager?
  key : symbol?
  message : string?
Adds a flash message to the current session. wrap-flash installs a private parameter that references the current flash manager for each wrapped request so the flashes argument is optional.