Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "api/mim"

Index

Type aliases

CompProps

CompProps<TProps, TChildren>: Readonly<TProps> & { children?: TChildren }

Type used to define properties that can be passed to a class-based component.

Type parameters

  • TProps

    Type defining properties that can be passed to the functional or class-based component with these properties. Default type is an empty object (no properties).

  • TChildren

    Type defining components, elements or other objects that can be used as children for the component with these properties. Default is any.

CrossoriginPropType

CrossoriginPropType: "anonymous" | "use-credentials"

ElmRefFunc

ElmRefFunc<T>: RefFunc<IElmVN<T>>

Defines event handler that is invoked when reference value changes.

Type parameters

  • T: Element

ElmRefPropType

ElmRefPropType<T>: RefPropType<IElmVN<T>>

Type of vnref property that can be passed to JSX elements.

Type parameters

  • T: Element

EventArrayType

EventArrayType<T>: []

Tuple containing parameters of event handler in the following order:

  • Event handler function.
  • Object that will be referenced by "this" within the event handler function.
  • Type of scheduling the Mimbl tick after the event handler function returns.
  • Object that will be set as "current creator" for JSX parsing during the event handler function execution.
  • Flag indicating whether this event should be used as Capturing (true) or Bubbling (false).

Type parameters

  • T: Event

    DOM event type, e.g. MouseEvent

EventFuncType

EventFuncType<T>: (e: T) => void

Type of event handler function for DOM events of type T.

Type parameters

  • T: Event

    DOM event type, e.g. MouseEvent

Type declaration

    • (e: T): void
    • Parameters

      • e: T

      Returns void

EventObjectType

EventObjectType<T>: { creator?: any; func: EventFuncType<T>; funcThisArg?: any; schedulingType?: TickSchedulingType; useCapture?: boolean }

Type parameters

  • T: Event

Type declaration

EventPropType

EventPropType<T>: EventFuncType<T> | EventArrayType<T> | EventObjectType<T>

Union type that can be passed to an Element's event.

Type parameters

  • T: Event

    DOM event type, e.g. MouseEvent

FormenctypePropType

FormenctypePropType: "application/x-www-form-urlencoded" | "multipart/form-data" | "text/plain"

FormmethodPropType

FormmethodPropType: "get" | "post" | "dialog"

FormtargetPropType

FormtargetPropType: string | "_self" | "_blank" | "_parent" | "_top"

IDPropType

IDPropType: string | number | IIDRule

Type for defining the id property of HTML elements

RefFunc

RefFunc<T>: (newRef: T) => void

Defines event handler that is invoked when reference value changes.

Type parameters

  • T

Type declaration

    • (newRef: T): void
    • Parameters

      • newRef: T

      Returns void

RefPropType

RefPropType<T>: T | Ref<T> | RefFunc<T>

Type of ref property that can be passed to JSX elements and components. This can be either the Ref class or RefFunc function.

Type parameters

  • T

ReferrerPolicyPropType

ReferrerPolicyPropType: "no-referrer" | "no-referrer-when-downgrade" | "origin" | "origin-when-cross-origin" | "unsafe-url"

RenderMethodType

RenderMethodType: (arg: any) => any

Definition of type of method that renders content.

Type declaration

    • (arg: any): any
    • Parameters

      • arg: any

      Returns any

ScheduledFuncType

ScheduledFuncType: () => void

Type of functions scheduled to be called either before or after the update cycle.

Type declaration

    • (): void
    • Returns void

TickSchedulingType

TickSchedulingType: "n" | "s" | "t" | "a" | undefined

UpdateStrategy

UpdateStrategy: { disableKeyedNodeRecycling?: boolean }

The UpdateStrategy object specifies different aspects of update behavior of components and elements.

Type declaration

  • Optional disableKeyedNodeRecycling?: boolean

    Flag determining whether or not non-matching new keyed sub-nodes are allowed to recycle non- matching old keyed sub-nodes. Here "non-matching" means those new or old nodes with keys for which no old or new sub-nodes with the same key were found. If this flag is true, then non-matching old sub-nodes will be removed and non-matching new sub-nodes will be inserted. If this flag is false, then non-matching old sub-nodes will be updated by the non-matching new sub-nodes - provided that the types of sub-nodes are the same.

    If keyed sub-nodes recycling is enabled it can speed up an update process because less DOM nodes get removed and inserted, which is more expensive than updating. However, this can have some adverse effects under cirtain circumstances if certain data is bound to the particular instances of DOM nodes.

    The flag's default value is false, that is recycling is enabled.

Variables

Let symRenderNoWatcher

symRenderNoWatcher: symbol = Symbol()

Symbol that is attached to a render function to indicate that it should not be wrapped in a watcher.

Functions

Fragment

  • An artificial "Fragment" component that is only used as a temporary collection of other items in places where JSX only allows a single item. Our JSX factory function creates a virtual node for each of its children and the function is never actually called. This function is only needed because currently TypeScript doesn't allow the <> fragment notation if a custom JSX factory function is used.

    Use it as follows:

        import * as mim from "mimbl"
        .....
        render()
        {
            return <Fragment>
                <div1/>
                <div2/>
                <div3/>
            </Fragment>
        }

    Parameters

    Returns any

createTextVN

  • createTextVN(text: string): ITextVN
  • Creates text virtual node, whcih can be used to update the text without re-rendering parent element.

    Parameters

    • text: string

      Text to initialize the text node

    Returns ITextVN

jsx

  • jsx(tag: any, props: any, ...children: any[]): any
  • JSX Factory function. In order for this function to be invoked by the TypeScript compiler, the tsconfig.json must have the following option:

    "compilerOptions":
    {
        "jsx": "react",
        "jsxFactory": "jsx"
    }

    The .tsx files must import the mimbl module as mim: import * as mim from "mimbl"

    Parameters

    • tag: any
    • props: any
    • Rest ...children: any[]

    Returns any

mount

  • mount(content: any, anchorDN?: Node): void
  • Renders the given content (usually result of JSX expression) under the given HTML element // asynchronously.

    Parameters

    • content: any

      Content to render.

    • Default value anchorDN: Node = null

      DOM element under which to render the content. If null or undefined,then render under the document.body tag.

    Returns void

noWatcher

  • noWatcher(target: any, name: string, propDescr: PropertyDescriptor): void
  • Decorator function for tagging a component's render function so that it will not be wrapped in a watcher.

    Parameters

    • target: any
    • name: string
    • propDescr: PropertyDescriptor

    Returns void

ref

  • ref(target: any, name: string): void
  • Decorator function for creating reference properties without the need to manually create Ref<> instances. This allows for the following code pattern:

    class A extends Component
    {
        @ref myDiv: HTMLDivElement;
        render() { return <div ref={this.myDiv}>Hello</div>; }
    }

    In the above example, the myDiv property will be set to point to the HTML div element.

    Parameters

    • target: any
    • name: string

    Returns void

registerCustomAttribute

  • Registers custom attribute handler class for the given property name.

    Type parameters

    • T

    Parameters

    Returns void

registerCustomEvent

  • registerCustomEvent(eventName: string): void
  • Registers custom event for the given property name.

    Parameters

    • eventName: string

    Returns void

setRef

  • setRef<T>(ref: RefPropType<T>, val: T, onlyIf?: T): void
  • Helper function to set the value of the reference that takes care of the different types of references. The optional onlyIf parameter may specify a value so that only if the reference currently has the same value it will be replaced. This might be needed to not clear a reference if it already points to a different object.

    Type parameters

    • T

    Parameters

    • ref: RefPropType<T>

      Ref object to which the new value will be set

    • val: T

      Reference value to set to the Ref object

    • Optional onlyIf: T

      An optional value to which to compare the current (old) value of the reference. The new value will be set only if the old value equals the onlyIf value.

    Returns void

unmount

  • unmount(anchorDN?: Node): void
  • Removes the content that was originally generated by the mount function.

    Parameters

    • Default value anchorDN: Node = null

      DOM element under which the content was previously rendered.

    Returns void

updatable

  • updatable(target: any, name: string): void
  • deprecated
    • use @trigger

    Parameters

    • target: any
    • name: string

    Returns void

Generated using TypeDoc