main
Last change
on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
893 bytes
|
Rev | Line | |
---|
[d565449] | 1 | 'use strict';
|
---|
| 2 |
|
---|
| 3 | var React = require('react');
|
---|
| 4 | var Component = React.Component;
|
---|
| 5 | var transformComponentStatic = require('./util/transformComponentStatic');
|
---|
| 6 | var transformComponentDynamic = require('./util/transformComponentDynamic');
|
---|
| 7 |
|
---|
| 8 | exports.addon = function (renderer) {
|
---|
| 9 | if (process.env.NODE_ENV !== 'production') {
|
---|
| 10 | require('./__dev__/warnOnMissingDependencies')('component', renderer, ['rule', 'cache']);
|
---|
| 11 | }
|
---|
| 12 |
|
---|
| 13 | function CssComponent (props, context) {
|
---|
| 14 | Component.call(this, props, context);
|
---|
| 15 |
|
---|
| 16 | var Comp = this.constructor;
|
---|
| 17 |
|
---|
| 18 | if (Comp.css) transformComponentStatic(renderer, Comp.prototype, Comp.css);
|
---|
| 19 | if (this.css) transformComponentDynamic(renderer, Comp, this.css.bind(this));
|
---|
| 20 | }
|
---|
| 21 |
|
---|
| 22 | CssComponent.prototype = Object.create(Component.prototype);
|
---|
| 23 | CssComponent.prototype.constructor = CssComponent;
|
---|
| 24 |
|
---|
| 25 | renderer.Component = CssComponent;
|
---|
| 26 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.