cartant / rxjs-spy

A debugging library for RxJS
https://cartant.github.io/rxjs-spy/
MIT License
702 stars 22 forks source link

detect doesn't work with custom plugin config #43

Open jecraig opened 5 years ago

jecraig commented 5 years ago

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 commented 5 years ago

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

cartant commented 5 years ago

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.