How to use the @appbaseio/reactivemaps.AppbaseChannelManager.create function in @appbaseio/reactivemaps

To help you get started, we’ve selected a few @appbaseio/reactivemaps examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github appbaseio / reactivesearch / app / sensors / DynamicRangeSlider.js View on Github external
createChannel() {
		// create a channel and listen the changes
		const channelObj = manager.create(this.context.appbaseRef, this.context.type, this.react, 100, 0, false, this.props.componentId);
		this.channelId = channelObj.channelId;
		this.channelListener = channelObj.emitter.addListener(channelObj.channelId, (res) => {
			if (res.error) {
				this.setState({
					queryStart: false
				});
			}
			if (res.appliedQuery) {
				const data = res.data;
				if (data && data.aggregations) {
					if (data.aggregations.max && data.aggregations.min) {
						this.setState({
							range: {
								min: data.aggregations.min.value,
								max: data.aggregations.max.value
							}
github appbaseio / reactivesearch / app / sensors / NestedMultiList.js View on Github external
createChannel() {
		this.includeAggQuery();
		// create a channel and listen the changes
		const channelObj = manager.create(this.context.appbaseRef, this.context.type, this.react, 100, 0, false, this.props.componentId);
		this.channelId = channelObj.channelId;
		this.channelListener = channelObj.emitter.addListener(this.channelId, (res) => {
			if (res.error) {
				this.setState({
					queryStart: false
				});
			}
			if (res.appliedQuery && Object.keys(res.appliedQuery).length) {
				this.queryLevel = this.getQueryLevel(res.appliedQuery);
				this.setState({
					queryStart: false,
					rawData: res.data
				});
				this.setData(res.data, this.queryLevel);
			}
		});
github appbaseio / reactivesearch / app / sensors / MultiLevelMenu.js View on Github external
createChannel() {
		for (let level = 1; level < this.props.dataField.length; level += 1) {
			const react = this.getReact(level);
			// create a channel and listen the changes
			this.channelObj[level] = manager.create(this.context.appbaseRef, this.context.type, react);
			this.channelId[level] = this.channelObj[level].channelId;
			this.channelListener[level] = this.localChannel(level, react);
			// this.listenLoadingChannel(channelObj, "loadListenerParent");
		}
		this.setInitialData();
	}
github appbaseio / reactivesearch / app / sensors / NestedList.js View on Github external
createChannel() {
		this.includeAggQuery();
		// create a channel and listen the changes
		const channelObj = manager.create(this.context.appbaseRef, this.context.type, this.react, 100, 0, false, this.props.componentId);
		this.channelId = channelObj.channelId;
		this.channelListener = channelObj.emitter.addListener(this.channelId, (res) => {
			if (res.error) {
				this.setState({
					queryStart: false
				});
			}
			if (res.appliedQuery && Object.keys(res.appliedQuery).length) {
				this.queryLevel = this.getQueryLevel(res.appliedQuery);
				this.setState({
					queryStart: false,
					rawData: res.data
				});
				this.setData(res.data, this.queryLevel);
			}
		});
github appbaseio / reactivesearch / app / actuators / ResultList.js View on Github external
createChannel(executeChannel = false) {
		// create a channel and listen the changes
		const channelObj = manager.create(this.context.appbaseRef, this.context.type, this.react, this.props.size, this.props.from, this.props.stream);
		this.channelId = channelObj.channelId;

		this.channelListener = channelObj.emitter.addListener(channelObj.channelId, (res) => {
			// implementation to prevent initialize query issue if old query response is late then the newer query
			// then we will consider the response of new query and prevent to apply changes for old query response.
			// if queryStartTime of channel response is greater than the previous one only then apply changes
			if (res.error && res.startTime > this.queryStartTime) {
				this.setState({
					queryStart: false,
					showPlaceholder: false
				});
			}
			if (res.appliedQuery) {
				if (res.mode === "historic" && res.startTime > this.queryStartTime) {
					const visibleNoResults = res.appliedQuery && res.data && !res.data.error ? (!(res.data.hits && res.data.hits.total)) : false;
					const resultStats = {
github appbaseio / reactivesearch / app / sensors / TagCloud.js View on Github external
createChannel() {
		this.includeAggQuery();
		// create a channel and listen the changes
		const channelObj = manager.create(this.context.appbaseRef, this.context.type, this.react);
		this.channelId = channelObj.channelId;
		this.channelListener = channelObj.emitter.addListener(this.channelId, (res) => {
			if (res.error) {
				this.setState({
					queryStart: false
				});
			}
			if (res.appliedQuery) {
				const data = res.data;
				let rawData;
				if (res.mode === "streaming") {
					rawData = this.state.rawData;
					rawData.hits.hits.push(res.data);
				} else if (res.mode === "historic") {
					rawData = data;
				}
github appbaseio / reactivesearch / app / actuators / ResultCard.js View on Github external
createChannel(executeChannel = false) {
		// create a channel and listen the changes
		const channelObj = manager.create(this.context.appbaseRef, this.context.type, this.react, this.props.size, this.props.from, this.props.stream);
		this.channelId = channelObj.channelId;

		this.channelListener = channelObj.emitter.addListener(channelObj.channelId, (res) => {
			// implementation to prevent initialize query issue if old query response is late then the newer query
			// then we will consider the response of new query and prevent to apply changes for old query response.
			// if queryStartTime of channel response is greater than the previous one only then apply changes
			if (res.error && res.startTime > this.queryStartTime) {
				this.setState({
					queryStart: false,
					showPlaceholder: false
				});
			}
			if (res.appliedQuery) {
				if (res.mode === "historic" && res.startTime > this.queryStartTime) {
					const visibleNoResults = res.appliedQuery && res.data && !res.data.error ? (!(res.data.hits && res.data.hits.total)) : false;
					const resultStats = {
github appbaseio / reactivesearch / app / sensors / CategorySearch.js View on Github external
createChannel() {
		const channelObj = manager.create(this.context.appbaseRef, this.context.type, this.react, 100, 0, false, this.props.componentId);
		this.channelId = channelObj.channelId;
		this.channelListener = channelObj.emitter.addListener(channelObj.channelId, (res) => {
			const data = res.data;
			let rawData;
			if (res.mode === "streaming") {
				rawData = this.state.rawData;
				rawData.hits.hits.push(res.data);
			} else if (res.mode === "historic") {
				rawData = data;
			}
			this.setState({
				rawData
			});
			this.setData(rawData, res.appliedQuery.body.query);
		});
		this.listenLoadingChannel(channelObj);