messages.svelte#

Classes#

Messages#

Defined in: editor/src/messages.svelte.ts:50

The messages shown, in the order posted.

Constructors#

Constructor#

new Messages(): Messages

Returns#

Messages

Properties#

shown#

shown: readonly Message[]

Defined in: editor/src/messages.svelte.ts:52

The messages shown, oldest first.

Methods#

dismiss()#

dismiss(id): void

Defined in: editor/src/messages.svelte.ts:80

Dismiss the message id.

Parameters#
id#

number

Returns#

void

dispose()#

dispose(): void

Defined in: editor/src/messages.svelte.ts:87

Cancel every pending self-dismissal; the messages are not used afterwards.

Returns#

void

post()#

post(level, text, problems?): void

Defined in: editor/src/messages.svelte.ts:63

Show a message. Information is dismissed after infoDurationOf its text, and replaces information of the same text still shown (posted again, it shows once, timed from now); a warning or an error stays until dismissed. Editing goes on either way.

Parameters#
level#

MessageLevel

text#

string

problems?#

readonly Problem[] = []

Returns#

void

Interfaces#

Message#

Defined in: editor/src/messages.svelte.ts:19

One message: its level, its text, and the reader’s problems when there are any.

Properties#

id#

readonly id: number

Defined in: editor/src/messages.svelte.ts:20

level#

readonly level: MessageLevel

Defined in: editor/src/messages.svelte.ts:21

problems#

readonly problems: readonly Problem[]

Defined in: editor/src/messages.svelte.ts:23

text#

readonly text: string

Defined in: editor/src/messages.svelte.ts:22

Type Aliases#

MessageLevel#

MessageLevel = "info" | "warning" | "error"

Defined in: editor/src/messages.svelte.ts:16

How much a message weighs: information passes by itself, a warning says what the user must know although nothing failed, an error reports an operation that failed. Warnings and errors stay until dismissed.


Post#

Post = (level, text, problems?) => void

Defined in: editor/src/messages.svelte.ts:47

Post one message at level, with the problems that explain it.

Parameters#

level#

MessageLevel

text#

string

problems?#

readonly Problem[]

Returns#

void

Variables#

INFO_DURATION_MS#

const INFO_DURATION_MS: 3000 = 3000

Defined in: editor/src/messages.svelte.ts:27

The least time a message of level info is shown.


INFO_MS_PER_WORD#

const INFO_MS_PER_WORD: 300 = 300

Defined in: editor/src/messages.svelte.ts:34

The time one word of information takes to read: 200 words a minute, the reading speed commonly assumed for text on a screen, which leaves room to notice the message before reading it.

Functions#

infoDurationOf()#

infoDurationOf(text): number

Defined in: editor/src/messages.svelte.ts:41

How long information of text is shown: INFO_DURATION_MS, or for a longer text INFO_MS_PER_WORD for each of its words (words being parts apart from one another by white space), whichever is longer.

Parameters#

text#

string

Returns#

number


messageOf()#

messageOf(error): string

Defined in: editor/src/messages.svelte.ts:118

The text of a failure to show the viewer: an error’s message, else the value as text.

Parameters#

error#

unknown

Returns#

string


postContext()#

postContext(post): Map<symbol, Post>

Defined in: editor/src/messages.svelte.ts:113

The component context that provides post, for a component mounted on its own (mount’s context).

Parameters#

post#

Post

Returns#

Map<symbol, Post>


postOf()#

postOf(): Post

Defined in: editor/src/messages.svelte.ts:106

The post a component above the calling one provides; called while the component is made.

Returns#

Post

Throws#

if none provides one.


providePost()#

providePost(post): void

Defined in: editor/src/messages.svelte.ts:96

Give the components below the calling one post; called while the component is made.

Parameters#

post#

Post

Returns#

void