Exemple #1
0
        public Application([NotNull] ApplicationDefinition definition)
        {
            Verify.ArgumentNotNull(definition, "definition");

            _definition = definition;
            _pathResolver = new PathResolver(definition);
            _componentLoader = ComponentLoader.Load(_pathResolver);

            _runtime = new JavascriptRuntime();
        }
Exemple #2
0
        public static ComponentLoader Load([NotNull] PathResolver pathResolver)
        {
            var catalog = new AggregateCatalog();

            catalog.Catalogs.Add(new AssemblyCatalog(typeof(Application).Assembly));
            catalog.Catalogs.Add(new AssemblyCatalog(Assembly.GetExecutingAssembly()));
            catalog.Catalogs.Add(new DirectoryCatalog(
                                     pathResolver.ResolvePath(PathRelativeTo.JsrDirectory, "exts"),
                                     @"*.dll"));

            var container = new CompositionContainer(catalog);

            var loader = new ComponentLoader(container);
            container.ComposeParts(loader);

            return loader;
        }