How to use the p-event.iterator function in p-event

To help you get started, we’ve selected a few p-event 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 box / boxcli / src / commands / events / poll.js View on Github external
}
		if (flags['end-date']) {
			options.endDate = flags['end-date'];
		}
		if (flags['polling-interval']) {
			options.pollingInterval = flags['polling-interval'];
		}

		await this.output('Polling started...');
		if (flags.enterprise) {
			stream = await this.client.events.getEnterpriseEventStream(options);
		} else {
			stream = await this.client.events.getEventStream(options);
		}

		let events = pEvent.iterator(stream, 'data');

		for await (let event of events) {
			await this.output(event);
			await this.output('**************************');
		}
	}
}

p-event

Promisify an event by waiting for it to be emitted

MIT
Latest version published 2 months ago

Package Health Score

85 / 100
Full package analysis

Popular p-event functions