Options
All
  • Public
  • Public/Protected
  • All
Menu

Module reconciler

Index

Type aliases

Child

Child: {}

Type declaration

ChildSet

ChildSet: { messageBody?: undefined | { content?: undefined | string; embed?: EmbedInstance }; onReactionRemoveAll?: ReactionRemoveAllHandler; onRenderingDone?: RenderingDoneHandler; reactions?: ReactionsInstance }

Type declaration

Container

Container: { channel: TextChannel | NewsChannel | DMChannel; content?: undefined | string; curMessage?: Message; embed?: EmbedInstance; errorHandler: (err: unknown) => void; ignoreReactionRemoveEvent: boolean; message?: Promise<Message>; onReactionRemoveAll?: ReactionRemoveAllHandler; onRenderingDone?: RenderingDoneHandler; reaction?: Promise<void>; reactionAbort?: AbortController; reactionUpdateSterategy?: "local" | "remote" | "force"; reactions?: { instance: ReactionInstance; rendered?: MessageReaction }[]; timestamp?: TimestampType; registerMessage: any }

Type declaration

  • channel: TextChannel | NewsChannel | DMChannel
  • Optional content?: undefined | string
  • Optional curMessage?: Message
  • Optional embed?: EmbedInstance
  • errorHandler: (err: unknown) => void
      • (err: unknown): void
      • Parameters

        • err: unknown

        Returns void

  • ignoreReactionRemoveEvent: boolean
  • Optional message?: Promise<Message>
  • Optional onReactionRemoveAll?: ReactionRemoveAllHandler
  • Optional onRenderingDone?: RenderingDoneHandler
  • Optional reaction?: Promise<void>
  • Optional reactionAbort?: AbortController
  • Optional reactionUpdateSterategy?: "local" | "remote" | "force"
  • Optional reactions?: { instance: ReactionInstance; rendered?: MessageReaction }[]
  • Optional timestamp?: TimestampType
  • registerMessage: function
    • registerMessage(message: Message): void

HostConfig

HostConfig<Type, Props, Container, Instance, TextInstance, HydratableInstance, PublicInstance, HostContext, UpdatePayload, ChildSet, TimeoutHandle, NoTimeout>: HostConfig<Type, Props, Container, Instance, TextInstance, HydratableInstance, PublicInstance, HostContext, UpdatePayload, ChildSet, TimeoutHandle, NoTimeout>

Type parameters

  • Type

  • Props

  • Container

  • Instance

  • TextInstance

  • HydratableInstance

  • PublicInstance

  • HostContext

  • UpdatePayload

  • ChildSet

  • TimeoutHandle

  • NoTimeout

HostContext

HostContext: {}

Type declaration

MessagePayload

MessagePayload: { content?: undefined | string; embed?: EmbedInstance }

Type declaration

  • Optional content?: undefined | string
  • Optional embed?: EmbedInstance

NoTimeout

NoTimeout: undefined

Props

Props: Record<string, unknown>

PublicInstance

PublicInstance: {}

Type declaration

TimeoutHandle

TimeoutHandle: Timeout

Type

Type: "discordjs_embed" | "discordjs_title"

UpdatePayload

UpdatePayload: never

Variables

Const reconciler

reconciler: Reconciler<Instance, string, Container, PublicInstance> = ReactReconciler<Type,Props,Container,Instance,TextInstance,never,PublicInstance,HostContext,UpdatePayload,ChildSet,TimeoutHandle,NoTimeout>({supportsMutation: false,supportsHydration: false,supportsPersistence: true,appendInitialChild: (parentInstance, child) => {try {parentInstance.appendChild(child);} catch (e) {console.error(e);}},cancelDeferredCallback: (handle) => {},clearTimeout: (handle) => {if (handle) {clearTimeout(handle);}},createInstance: (type, props, container) => {const f = instanceFactory[type];if (f == null) {container.errorHandler(new RenderError("type is not implemented:" + type, { type, props }));}try {return f(props, { messageGetter: () => container.curMessage });} catch (e) {container.errorHandler(e);}},createTextInstance: (text) => {return text;},finalizeInitialChildren: () => {return false;},getChildHostContext: () => {return {};},getPublicInstance: (instance) => {return instance;},getRootHostContext: () => {return {};},isPrimaryRenderer: false,noTimeout: undefined,now: () => {return Date.now();},prepareForCommit: () => {return null;},prepareUpdate: () => {throw new Error("not implemented");},// eslint-disable-next-line @typescript-eslint/no-empty-functionresetAfterCommit: () => {},scheduleDeferredCallback: () => {},setTimeout: (handler: (...args: unknown[]) => void, timeout: number) => {return setTimeout(handler, timeout);},shouldDeprioritizeSubtree: () => {return false;},shouldSetTextContent: () => {return false;},unhideInstance: () => {},appendChildToContainerChildSet: (childSet, child) => {if (child == null) {return;}if (typeof child === "string") {return;}if (child.type !== "message") {return;}childSet.onRenderingDone = child.onRenderingDone;childSet.messageBody = child.messageBody;childSet.onReactionRemoveAll = child.reactions?.onReactionRemoveAll;childSet.reactions = child.reactions;},cloneInstance: (instance) => {if (typeof instance === "string") {return instance;}return instance.cloneSelf();},createContainerChildSet: () => {return {};},finalizeContainerChildren: () => {//noop},replaceContainerChildren: (container, newChildren) => {// processing messagesif (!messageUpdated({ content: container.content, embed: container.embed },newChildren.messageBody ?? {})) {return;}Object.assign(container, {content: newChildren.messageBody?.content,embed: newChildren.messageBody?.embed,timestamp: newChildren.messageBody?.embed?.timestamp,});container.onReactionRemoveAll = newChildren.onReactionRemoveAll;const embed = createEmbed(container);if (container.message) {container.message = container.message.then((e) =>e.edit(container.content, embed));} else {container.message = container.channel.send(container.content, embed);}// eslint-disable-next-line @typescript-eslint/no-floating-promisescontainer.message.then((message) => {container.curMessage = message;container.registerMessage(message);});// processing reactionsif (newChildren.reactions) {reactionUpdateSterategyFactory[newChildren.reactions.strategy](container,newChildren);}container.onRenderingDone = newChildren.onRenderingDone;},} as HostConfig<Type, Props, Container, Instance, TextInstance, never, PublicInstance, HostContext, UpdatePayload, ChildSet, TimeoutHandle, NoTimeout>)

Functions

createEmbed

messageUpdated

Generated using TypeDoc