rxjs-spy icon indicating copy to clipboard operation
rxjs-spy copied to clipboard

detect doesn't work with custom plugin config

Open jecraig opened this issue 6 years ago • 2 comments

detect throws up the warning 'Snapshotting is not enabled.' if you don't use the defaultPlugin setting.

import { create } from 'rxjs-spy';
import {
	GraphPlugin,
	SnapshotPlugin,
	StackTracePlugin,
	StatsPlugin,
} from 'rxjs-spy/plugin';
const spy = create({
	defaultPlugins: false,
	warning: true,
});
spy.plug(
	new StackTracePlugin({ sourceMaps: false }),
	new GraphPlugin({ keptDuration: 15000 }),
	new SnapshotPlugin(spy, { keptValues: 4 }),
	new StatsPlugin(spy),
);
window['spy'].detect();

jecraig avatar Feb 20 '19 01:02 jecraig

The problem seems to be that you create the Detector object during create() and the Detector only looks for the snapshot plugin in the constructor.

https://github.com/cartant/rxjs-spy/blob/master/source/spy-core.ts#L108 https://github.com/cartant/rxjs-spy/blob/master/source/detector.ts#L48

jecraig avatar Feb 20 '19 01:02 jecraig

Yeah. That is a problem, but I'm not going to fix it right now.

When I release rxjs-devtools - which I'm working on ATM - rxjs-spy is going to be deprecated. I've removed the detector from rxjs-devtools as it includes a superior and less-intrusive mechanism for doing what I attempted to do with the detector in rxjs-spy.

cartant avatar Feb 20 '19 02:02 cartant