Trilium Frontend API
    Preparing search index...

    Interface ModelSchemaContextItem

    An item of the module:engine/model/schema~ModelSchemaContext schema context.

    It contains 3 properties:

    • name – the name of this item,
    • * getAttributeKeys() – a generator of keys of item attributes,
    • getAttribute( keyName ) – a method to get attribute values.

    The context item interface is a highly simplified version of module:engine/model/node~ModelNode and its role is to expose only the information which schema checks are able to provide (which is the name of the node and node's attributes).

    schema.on( 'checkChild', ( evt, args ) => {
    const ctx = args[ 0 ];
    const firstItem = ctx.getItem( 0 );

    console.log( firstItem.name ); // -> '$root'
    console.log( firstItem.getAttribute( 'foo' ) ); // -> 'bar'
    console.log( Array.from( firstItem.getAttributeKeys() ) ); // -> [ 'foo', 'faa' ]
    } );
    interface ModelSchemaContextItem {
        name: string;
        getAttribute(keyName: string): unknown;
        getAttributeKeys(): Generator<string>;
    }
    Index

    Properties

    name: string

    Methods

    • Parameters

      • keyName: string

      Returns unknown

    • Returns Generator<string>