Apply view wrappers. E.g. the `@reframe/react-router` plugin adds a view wrapper to add the provider-components `<BrowserRouter>` and `<StaticRouter>`.
541751
function applyViewWrappers({reactElement, initialProps, viewWrappers=[]}) {
    viewWrappers
    .forEach(viewWrapper => {
        reactElement = viewWrapper(reactElement, initialProps);
    });
    return reactElement;
}
48657
public void addRegexRoute(String urlPattern, Class<? extends Actor> actorClass) throws RouteAlreadyMappedException {
        addRoute(new Route(urlPattern, true), actorClass);
    }
537314
public final void addComponent(ComponentRenderer component)
    {
        renderers.add(component);
        services.add(component);
        if (component instanceof HandlerListener)
        {
            addListener((HandlerListener) component);
        }
    }
1186592
function () {

				this.router = this.getRouter();
				this.router.getRoute("entity").attachPatternMatched(this.onRouteMatched, this);

				this._oObjectPage = this.byId("ObjectPageLayout");

				this.getView().setModel(new JSONModel());
			}
1041023
def _add_addon_views(self):
        
        for addon in self._addon_managers:
            addon_class = dynamic_class_import(addon)
            if addon_class:
                # Instantiate manager with appbuilder (self)
                addon_class = addon_class(self)
                try:
                    addon_class.pre_process()
                    addon_class.register_views()
                    addon_class.post_process()
                    self.addon_managers[addon] = addon_class
                    log.info(LOGMSG_INF_FAB_ADDON_ADDED.format(str(addon)))
                except Exception as e:
                    log.exception(e)
                    log.error(LOGMSG_ERR_FAB_ADDON_PROCESS.format(addon, e))
405650
def register_views(self, app):
        

        # Wrap the views in an arbitrary number of decorators.
        def wrap_view(view):
            if self.decorators:
                for decorator in self.decorators:
                    view = decorator(view)
            return view

        if self.config.get('swagger_ui', True):
            uiversion = self.config.get('uiversion', 3)
            blueprint = Blueprint(
                self.config.get('endpoint', 'flasgger'),
                __name__,
                url_prefix=self.config.get('url_prefix', None),
                subdomain=self.config.get('subdomain', None),
                template_folder=self.config.get(
                    'template_folder', 'ui{0}/templates'.format(uiversion)
                ),
                static_folder=self.config.get(
                    'static_folder', 'ui{0}/static'.format(uiversion)
                ),
                static_url_path=self.config.get('static_url_path', None)
            )

            blueprint.add_url_rule(
                self.config.get('specs_route', '/apidocs/'),
                'apidocs',
                view_func=wrap_view(APIDocsView().as_view(
                    'apidocs',
                    view_args=dict(config=self.config)
                ))
            )

            # backwards compatibility with old url style
            blueprint.add_url_rule(
                '/apidocs/index.html',
                view_func=lambda: redirect(url_for('flasgger.apidocs'))
            )
        else:
            blueprint = Blueprint(
                self.config.get('endpoint', 'flasgger'),
                __name__
            )

        for spec in self.config['specs']:
            self.endpoints.append(spec['endpoint'])
            blueprint.add_url_rule(
                spec['route'],
                spec['endpoint'],
                view_func=wrap_view(APISpecsView.as_view(
                    spec['endpoint'],
                    loader=partial(
                        self.get_apispecs, endpoint=spec['endpoint'])
                ))
            )

        app.register_blueprint(blueprint)
498809
function resolveReflectiveProviders(providers) {
	        var normalized = _normalizeProviders(providers, []);
	        var resolved = normalized.map(resolveReflectiveProvider);
	        return MapWrapper.values(mergeResolvedReflectiveProviders(resolved, new Map()));
	    }
32071
def _push(self, title, view, class_name, is_class, **kwargs):
        

        # Set the page title
        set_view_attr(view, "title", title, cls_name=class_name)

        module_name = view.__module__
        method_name = view.__name__

        _endpoint = build_endpoint_route_name(view, "index" if is_class else method_name, class_name)
        endpoint = kwargs.pop("endpoint", _endpoint)
        kwargs.setdefault("endpoint_kwargs", {})
        order = kwargs.pop("order", 0)

        # Tags
        _nav_tags = get_view_attr(view, "nav_tags", ["default"], cls_name=class_name)
        tags = kwargs.pop("tags", _nav_tags)
        if not isinstance(tags, list):
            _ = tags
            tags = [_]
        kwargs["tags"] = tags

        # visible: accepts a bool or list of callback to execute
        visible = kwargs.pop("visible", [True])
        if not isinstance(visible, list):
            visible = [visible]

        if get_view_attr(view, "nav_visible", cls_name=class_name) is False:
            visible = False

        kwargs["view"] = view
        kwargs["visible"] = visible
        kwargs["active"] = False
        kwargs["key"] = class_name

        if is_class:  # class menu
            kwargs["endpoint"] = endpoint
            kwargs["has_subnav"] = True
        else:
            kwargs["has_subnav"] = False
            kwargs.update({
                "order": order,
                "has_subnav": False,
                "title": title,
                "endpoint": endpoint,
            })

        self._title_map[endpoint] = title

        path = "%s.%s" % (module_name, method_name if is_class else class_name)
        attach_to = kwargs.pop("attach_to", [])
        if not attach_to:
            attach_to.append(path)

        for path in attach_to:
            if path not in self.MENU:
                self.MENU[path] = {
                    "title": None,
                    "endpoint": None,
                    "endpoint_kwargs": {},
                    "order": None,
                    "subnav": [],
                    "kwargs": {}
                }

            if is_class:  # class menu
                self.MENU[path]["title"] = title
                self.MENU[path]["order"] = order
                self.MENU[path]["kwargs"] = kwargs

            else:  # sub menu
                self.MENU[path]["subnav"].append(kwargs)
505434
function initViews () {
    // list of views - may be empty
    this.modelViews = []
    // if view is false no model views will be applied overriding any defaults
    if (this.args.view === false) {
        return
    }
    // get view from args or default
    var viewArg = defined(this.args.view) ? this.args.view : this.model.views.default
    // skip unless view arg is set from args or default
    if (!defined(viewArg)) {
        return
    }
    // list of views to apply to model
    var views
    // if view is string then convert to array
    if (typeof viewArg === 'string') {
        views = [viewArg]
    }
    // if view is array use it
    else if (Array.isArray(viewArg)) {
        views = viewArg
    }
    // invalid argument
    else {
        throw this.error('invalid view argument')
    }
    // iterate over views getting model view objects
    _.each(views, view => {
        var modelView = requireValidModelView(view, this.model.views, true)
        // if result is array then add all
        if (Array.isArray(modelView)) {
            _.each(modelView, modelView => this.modelViews.push(modelView))
        }
        // otherwise add object
        else {
            this.modelViews.push(modelView)
        }
    })
    // instantiate model view engine if there are views
    if (this.modelViews.length > 0) {
        this.modelViewEngine = new ImmutableCoreModelViewEngine({query: this})
    }
}
528847
def add_handlers(web_app, config):
    
    base_url = web_app.settings['base_url']
    url = ujoin(base_url, config.page_url)
    assets_dir = config.assets_dir

    package_file = os.path.join(assets_dir, 'package.json')
    with open(package_file) as fid:
        data = json.load(fid)

    config.version = config.version or data['version']
    config.name = config.name or data['name']

    handlers = [
        # TODO Redirect to /tree
        (url + r'/?', NAppHandler, {'config': config, 'page': 'tree'}),
        (url + r"/tree%s" % path_regex, NAppHandler, {'config': config, 'page': 'tree'}),
        (url + r"/edit%s" % path_regex, NAppHandler, {'config': config, 'page': 'edit'}),
        (url + r"/view%s" % path_regex, NAppHandler, {'config': config, 'page': 'view'}),
        (url + r"/static/(.*)", FileFindHandler, {'path': assets_dir}),
    ]

    web_app.add_handlers(".*$", handlers)
18032
def __add_class_views(self):
        
        config = self.config
        if "class_views" in self.kwargs:
            class_views = self.kwargs.pop("class_views")

            for route, view in class_views:
                if issubclass(view, endpoints.BaseEndpoint) and isinstance(
                    route, str
                ):
                    self.bp.add_route(
                        view.as_view(
                            self.responses,
                            config=self.config,
                            instance=self.instance,
                        ),
                        route,
                        strict_slashes=config.strict_slashes(),
                    )
                else:
                    raise exceptions.InvalidClassViewsFormat()
827365
function () {
    // Create and attach our main view
    this.mainView = new MainView({
      model: this.me,
      el: document.body
    });

    // this kicks off our backbutton tracking (browser history)
    // and will cause the first matching handler in the router
    // to fire.
    this.router.history.start({
      root: '/',
      pushState: true
    });
  }
1212483
function updatePrimaryRootContext(wrappingComponent) {
  const adapter = getAdapter(wrappingComponent[OPTIONS]);
  const primaryWrapper = wrappingComponent[PRIMARY_WRAPPER];
  const primaryRenderer = primaryWrapper[RENDERER];
  const primaryNode = primaryRenderer.getNode();
  const {
    legacyContext,
    providerValues,
  } = getContextFromWrappingComponent(wrappingComponent, adapter);
  const prevProviderValues = primaryWrapper[PROVIDER_VALUES];

  primaryWrapper.setContext({
    ...wrappingComponent[PRIMARY_WRAPPER][OPTIONS].context,
    ...legacyContext,
  });
  primaryWrapper[PROVIDER_VALUES] = new Map([...prevProviderValues, ...providerValues]);

  if (typeof adapter.isContextConsumer === 'function' && adapter.isContextConsumer(primaryNode.type)) {
    const Consumer = primaryNode.type;
    // Adapters with an `isContextConsumer` method will definitely have a `getProviderFromConsumer`
    // method.
    const Provider = adapter.getProviderFromConsumer(Consumer);
    const newValue = providerValues.get(Provider);
    const oldValue = prevProviderValues.get(Provider);

    // Use referential comparison like React
    if (newValue !== oldValue) {
      primaryWrapper.rerender();
    }
  }
}
58205
function withRouter(Component) {
  const displayName = `withRouter(${Component.displayName || Component.name})`;
  const C = props => {
    const { wrappedComponentRef, ...remainingProps } = props;

    return (
      <RouterContext.Consumer>
        {context => {
          invariant(
            context,
            `You should not use <${displayName} /> outside a <Router>`
          );
          return (
            <Component
              {...remainingProps}
              {...context}
              ref={wrappedComponentRef}
            />
          );
        }}
      </RouterContext.Consumer>
    );
  };

  C.displayName = displayName;
  C.WrappedComponent = Component;

  if (__DEV__) {
    C.propTypes = {
      wrappedComponentRef: PropTypes.func
    };
  }

  return hoistStatics(C, Component);
}
787233
static Router<ServiceConfig> wrapVirtualHostRouter(Router<ServiceConfig> delegate) {
        return CACHE == null ? delegate
                             : new CachingRouter<>(delegate, CACHE, ServiceConfig::pathMapping);
    }
956486
function addAvailableComponents(req, res, next) {
  res.locals.components = files.getComponents();
  next();
}
886872
function () {
			this.router = UIComponent.getRouterFor(this);
			this.router.attachRoutePatternMatched(this.onRouteMatched, this);
			this._component = Component.getOwnerComponentFor(this.getView());
			// click handler for @link tags in JSdoc fragments
			this.getView().attachBrowserEvent("click", this.onJSDocLinkClick, this);

			this.getView().addEventDelegate({
				onBeforeFirstShow: jQuery.proxy(this._applyViewConfigurations, this)
			});
		}