mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
react app
This commit is contained in:
58
react-app/node_modules/react/lib/createFullPageComponent.js
generated
vendored
Normal file
58
react-app/node_modules/react/lib/createFullPageComponent.js
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
/**
|
||||
* Copyright 2013-2015, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @providesModule createFullPageComponent
|
||||
* @typechecks
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
// Defeat circular references by requiring this directly.
|
||||
var ReactClass = require("./ReactClass");
|
||||
var ReactElement = require("./ReactElement");
|
||||
|
||||
var invariant = require("./invariant");
|
||||
|
||||
/**
|
||||
* Create a component that will throw an exception when unmounted.
|
||||
*
|
||||
* Components like <html> <head> and <body> can't be removed or added
|
||||
* easily in a cross-browser way, however it's valuable to be able to
|
||||
* take advantage of React's reconciliation for styling and <title>
|
||||
* management. So we just document it and throw in dangerous cases.
|
||||
*
|
||||
* @param {string} tag The tag to wrap
|
||||
* @return {function} convenience constructor of new component
|
||||
*/
|
||||
function createFullPageComponent(tag) {
|
||||
var elementFactory = ReactElement.createFactory(tag);
|
||||
|
||||
var FullPageComponent = ReactClass.createClass({
|
||||
tagName: tag.toUpperCase(),
|
||||
displayName: 'ReactFullPageComponent' + tag,
|
||||
|
||||
componentWillUnmount: function() {
|
||||
("production" !== process.env.NODE_ENV ? invariant(
|
||||
false,
|
||||
'%s tried to unmount. Because of cross-browser quirks it is ' +
|
||||
'impossible to unmount some top-level components (eg <html>, <head>, ' +
|
||||
'and <body>) reliably and efficiently. To fix this, have a single ' +
|
||||
'top-level component that never unmounts render these elements.',
|
||||
this.constructor.displayName
|
||||
) : invariant(false));
|
||||
},
|
||||
|
||||
render: function() {
|
||||
return elementFactory(this.props);
|
||||
}
|
||||
});
|
||||
|
||||
return FullPageComponent;
|
||||
}
|
||||
|
||||
module.exports = createFullPageComponent;
|
Reference in New Issue
Block a user