Skip to content
This repository has been archived by the owner on Apr 25, 2019. It is now read-only.

Declarations

Vlad Pazych edited this page Feb 16, 2017 · 1 revision

Declarations is a part of generator, where you declare all classes, that needs to be generated.

The name of this folder is hardcoded, because of how naming of components works.

Structure of folder

Structure of this folder is not important. map will require all files from it recursively for side-effects.

Structure of each file

Each file should export instance of class with things as properties.

For example:

import { component, ucomponent } from '../lib/lib';
import alias from './alias'
import contexts from './contexts';

class all {
    // Components without specified context will be added to context.core (see ../modifier.ts).
    application = ucomponent()
    loaded = component()

    // To make component available in more than one context:
    name = component({
        value: alias.string
    }).Contexts(contexts.core, contexts.meta) // Will be in both core and meta contexts
    
    action = component({
        value: alias.string
    }).Contexts(contexts.meta) // Will be in meta context only
    resolved = component().Contexts(contexts.meta) // Will be in meta context only
};

export default new all();
Clone this wiki locally