Ejemplo n.º 1
0
        value: function(instances, targetDocument) {
            var self = this,
                fragment,
                part = new DocumentPart(),
                templateObjects,
                templateParameters;

            instances = instances || this._instances;
            fragment = this._createMarkupDocumentFragment(targetDocument);
            templateParameters = this._getParameters(fragment);

            part.initWithTemplateAndFragment(this, fragment);
            part.startActingAsTopComponent();
            part.parameters = templateParameters;

            templateObjects = this._createTemplateObjects(instances);

            return this._instantiateObjects(templateObjects, fragment)
            .then(function(objects) {
                var resources;

                part.objects = objects;
                self._invokeDelegates(part, instances);
                part.stopActingAsTopComponent();

                resources = self.getResources();
                if (!resources.resourcesLoaded() && resources.hasResources()) {
                    // TODO: We were waiting for all resources to be
                    // loaded before considering the template loaded.
                    // Since we need the template to be loaded in order to load
                    // the rest of the component tree this turns the loading of
                    // each component tree level into a serial operation.
                    // This is particularly bad for mobile devices like the
                    // iPad where the network connection is a bottleneck making
                    // the application load very slowly.
                    // We need to adopt a different strategy where the resources
                    // can be loaded in parallel, for now we preload the
                    // resources but don't wait for them.
                    resources.loadResources(targetDocument);
                }
                return part;
            });
        }
Ejemplo n.º 2
0
        value: function(instances, targetDocument) {
            var self = this,
                fragment,
                part = new DocumentPart(),
                templateObjects,
                templateParameters;

            instances = instances || this._instances;
            fragment = this._createMarkupDocumentFragment(targetDocument);
            templateParameters = this._getParameters(fragment);

            part.initWithTemplateAndFragment(this, fragment);
            part.startActingAsTopComponent();
            part.parameters = templateParameters;

            templateObjects = this._createTemplateObjects(instances);

            return this._instantiateObjects(templateObjects, fragment)
            .then(function(objects) {
                var resources;

                part.objects = objects;
                self._invokeDelegates(part, instances);
                part.stopActingAsTopComponent();

                resources = self.getResources();
                if (!resources.resourcesLoaded() && resources.hasResources()) {
                    // Start preloading the resources as soon as possible, no
                    // need to wait for them as the draw cycle will take care
                    // of that when loading the stylesheets into the document.
                    resources.loadResources(targetDocument)
                    .done();
                }
                return part;
            });
        }
Ejemplo n.º 3
0
            .then(function(objects) {
                var resources;

                part.objects = objects;
                self._invokeDelegates(part, instances);
                part.stopActingAsTopComponent();

                resources = self.getResources();
                if (!resources.resourcesLoaded() && resources.hasResources()) {
                    // Start preloading the resources as soon as possible, no
                    // need to wait for them as the draw cycle will take care
                    // of that when loading the stylesheets into the document.
                    resources.loadResources(targetDocument)
                    .done();
                }
                return part;
            });
Ejemplo n.º 4
0
            .then(function(objects) {
                var resources;

                part.objects = objects;
                self._invokeDelegates(part, instances);
                part.stopActingAsTopComponent();

                resources = self.getResources();
                if (!resources.resourcesLoaded() && resources.hasResources()) {
                    // TODO: We were waiting for all resources to be
                    // loaded before considering the template loaded.
                    // Since we need the template to be loaded in order to load
                    // the rest of the component tree this turns the loading of
                    // each component tree level into a serial operation.
                    // This is particularly bad for mobile devices like the
                    // iPad where the network connection is a bottleneck making
                    // the application load very slowly.
                    // We need to adopt a different strategy where the resources
                    // can be loaded in parallel, for now we preload the
                    // resources but don't wait for them.
                    resources.loadResources(targetDocument);
                }
                return part;
            });