Using Strelit Layout with RequireJS

Like most modern libraries, Strelit Layout uses UMD (Universal Module Definition) to ensure compatibility with AMD / RequireJS and CommonJS alike. This means that when it comes to using it with RequireJS, there really isn't much to it.

jQuery

Strelit Layout depends on jQuery. When requiring Strelit Layout it in turn will require 'jquery' (all lowercase) which is the name that jQuery registeres itself under as a named module. So all that's left is telling RequireJS where this model can be found, e.g. like this:

requirejs.config({
    paths: {
        'jquery': 'lib/jquery'
    }
});

And that's it. Now you can require Strelit Layout and your components and start it, e.g. like that:

requirejs.config({
    baseUrl: '../js',
    paths: {
        'jquery': 'lib/jquery'
    }
});

require( [ 'lib/strelit', 'src/TestComponent' ], 
    function( StrelitLayout, TestComponent ){

    var myLayout = new StrelitLayout({
        content:[{
            type: 'row',
            content: [{
                type: 'component',
                componentName: 'testComponent',
                componentState: { title: 'First Item' }
            },{
                type: 'component',
                componentName: 'testComponent',
                componentState: { title: 'Second Item' }
            }]
        }]
    });

    myLayout.registerComponent( 'testComponent', TestComponent );
    myLayout.init();
});

Community & Support

Need help or have architectural questions?

Whether you are building complex multi-screen trading terminals, enterprise data workspaces, or migrating from legacy layout engines, the Strelit UI Kit engineering team and community are here to help.

Open an Issue on GitHub →