示例#1
0
    function Hub(layout, defaultSrc) {
        this.layout = layout;
        this.defaultSrc = defaultSrc;
        this.editorIds = new Ids();
        this.compilerIds = new Ids();
        this.compilerService = new CompilerService();

        var self = this;
        layout.registerComponent(Components.getEditor().componentName,
            function (container, state) {
                return self.codeEditorFactory(container, state);
            });
        layout.registerComponent(Components.getCompiler().componentName,
            function (container, state) {
                return self.compilerFactory(container, state);
            });
        layout.registerComponent(Components.getOutput().componentName,
            function (container, state) {
                return self.outputFactory(container, state);
            });
        layout.registerComponent(diff.getComponent().componentName,
            function (container, state) {
                return self.diffFactory(container, state);
            });
        layout.registerComponent(Components.getOptView().componentName,
            function (container, state) {
                return self.optViewFactory(container, state);
            });
        layout.registerComponent(Components.getAstView().componentName,
            function (container, state) {
                return self.astViewFactory(container, state);
            });
        layout.registerComponent(Components.getConformanceView().componentName,
            function (container, state) {
                return self.confomanceFactory(container, state);
            });

        layout.eventHub.on('editorOpen', function (id) {
            this.editorIds.add(id);
        }, this);
        layout.eventHub.on('editorClose', function (id) {
            this.editorIds.remove(id);
        }, this);
        layout.eventHub.on('compilerOpen', function (id) {
            this.compilerIds.add(id);
        }, this);
        layout.eventHub.on('compilerClose', function (id) {
            this.compilerIds.remove(id);
        }, this);
        layout.init();
    }
示例#2
0
 var conformanceConfig = _.bind(function () {
     return Components.getConformanceView(this.id, this.getSource());
 }, this);