Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Variables

mimblStyleSchedulerType

mimblStyleSchedulerType: number

Mimbl style scheduler as the default scheduler for style-related DOM-writing operations.

Functions

createTextVN

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

    Parameters

    • text: string

      Text to initialize the text node

    Returns ITextVN

Const lazy

  • lazy<T>(funcOrPromise: Promise<T> | (() => Promise<T>)): Promise<T> & { [ K in string | number | symbol]: T[K] & Promise<T[K]> }
  • Accepts a promise or a function that returns a promise, and returns an object, which will throw a promise for any property access until the promise is settled. If the promise is successfully resolved, property access will proceed to the object returned by the promise. If the promise is rejected, property access will throw the rejection error.

    Although this can be used with any promise, this should be primarily used for dynamic imports in conjunction with code-splitting, for example:

    // dynamically import OtherModule
    const OtherModule = mim.lazy(() => import("./OtherModule"));

    function MyComp(): any
    {
    return <OtherModule.OtherComp />
    }

    OR alternatively:

    // dynamically import OtherModule
    const OtherComp = mim.lazy(import("./OtherModule")).OtherComp;

    function MyComp(): any
    {
    return <OtherComp />
    }

    For more inormation see Component Lazy-Loading

    Type parameters

    • T: object

      Type to which the promise resolves. Since this function is intended to be called with dynamic import() statement, this type will normally be typeof import(...); that is, it will be an object containing all exported module members.

    Parameters

    • funcOrPromise: Promise<T> | (() => Promise<T>)

      Either a promise returned from the dynamic import statement or a function that returns such promise. If the parameter is a function, it will be called when the returned object is first used. This can defer downloading until the object is really needed.

    Returns Promise<T> & { [ K in string | number | symbol]: T[K] & Promise<T[K]> }

    Object providing property access to the object returned when the promise is resolved.

Const mount

  • mount(content: any, anchorDN?: DN): null | IRootVN
  • Renders the given content (usually result of JSX expression) under the given HTML element asynchronously.

    Parameters

    • content: any

      Content to render.

    • anchorDN: DN = null

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

    Returns null | IRootVN

noWatcher

  • noWatcher(target: any, name: string, propDescr: PropertyDescriptor): void
  • Decorator function for tagging a component's render function (or other rendering functions) 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 mim.Component
    {
    @mim.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

    • attrName: string

      Name of the custom attribute

    • handlerClass: ICustomAttributeHandlerClass<T>

      Class handling the custom attribute functionality

    Returns void

Const unmount

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

    Parameters

    • anchorDN: DN = null

      DOM element under which the content was previously rendered.

    Returns void

Const withShadow

  • Decorator function for components that allows them to use shadow DOM.

    Examples:

    // A `<div>` element will be created with shadow DOM in open mode
    @mim.withShadow
    class MyComponent extends mim.Component {...}

    // A `<span>` element will be created with shadow DOM in open mode
    @mim.withShadow("span")
    class MyComponent extends mim.Component {...}

    // A `<div>` element will be created with shadow DOM in closed mode
    @mim.withShadow( {mode: "closed"})
    class MyComponent extends mim.Component {...}

    // A `<span>` element will be created with shadow DOM in closed mode
    @mim.withShadow( ["span", {mode: "closed"}])
    class MyComponent extends mim.Component {...}

    Parameters

    Returns any

Const wrapCallback

  • Wraps the given callback and returns a function with identical signature.

    Type parameters

    • T: Function

    Parameters

    Returns T