@bloc-js/react-bloc
Advanced tools
Comparing version 1.0.1 to 1.1.0
"use strict"; | ||
var __extends = (this && this.__extends) || (function () { | ||
var extendStatics = function (d, b) { | ||
extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
}; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const react_1 = require("react"); | ||
const rxjs_1 = require("rxjs"); | ||
class BlocBuilder extends react_1.Component { | ||
constructor(props) { | ||
super(props); | ||
this.subscription = rxjs_1.Subscription.EMPTY; | ||
var react_1 = require("react"); | ||
var rxjs_1 = require("rxjs"); | ||
var BlocBuilder = (function (_super) { | ||
__extends(BlocBuilder, _super); | ||
function BlocBuilder(props) { | ||
var _this = _super.call(this, props) || this; | ||
_this.state = { data: _this.props.bloc.currentState }; | ||
_this.subscription = rxjs_1.Subscription.EMPTY; | ||
return _this; | ||
} | ||
componentDidMount() { | ||
this.subscription = this.props.bloc.state$.subscribe(data => { | ||
this.setState({ data }); | ||
BlocBuilder.prototype.componentDidMount = function () { | ||
var _this = this; | ||
this.subscription = this.props.bloc.state$.subscribe(function (data) { | ||
_this.setState({ data: data }); | ||
}); | ||
this.setState({ data: this.props.bloc.currentState }); | ||
} | ||
componentWillUnmount() { | ||
}; | ||
BlocBuilder.prototype.componentWillUnmount = function () { | ||
this.subscription.unsubscribe(); | ||
} | ||
render() { | ||
}; | ||
BlocBuilder.prototype.render = function () { | ||
return this.props.builder(this.state.data); | ||
} | ||
} | ||
}; | ||
return BlocBuilder; | ||
}(react_1.Component)); | ||
exports.BlocBuilder = BlocBuilder; | ||
//# sourceMappingURL=bloc-builder.js.map |
{ | ||
"name": "@bloc-js/react-bloc", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "React components for implementing the BLoC pattern.", | ||
@@ -42,3 +42,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "4c0e05dc5924500340c7af54235593143abb9eec" | ||
"gitHead": "39d98e1bc2bb1d925e7f95f51c6a99d55421965f" | ||
} |
Sorry, the diff of this file is not supported yet
4413
63