Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public setRootStore(rootStore: any, initialData: any) {
if (__DEV__) {
// this.rootStore = rootStore as RootStoreType;
const name = 'ROOT STORE';
Tron.display({
name,
value: initialData,
preview: 'Initial State',
});
// onSnapshot(rootStore, snapshot => {
// Tron.display({ name, value: snapshot, preview: 'New State' });
// });
// tslint:disable-next-line
// (console.tron as ReactotronWithPlugins).trackMstNode(rootStore);
}
}
export function * startup(action?: Action): SagaIterator {
if (__DEV__) {
// straight-up string logging
Reactotron.log("Hello, I'm an example of how to log via Reactotron.");
Reactotron.log(action);
// logging an object for better clarity
Reactotron.log({
message: "pass objects for better logging",
someGeneratorFunction: selectAvatar,
});
// fully customized!
const subObject = { a: 1, b: [1, 2, 3], c: true, circularDependency: undefined as any};
subObject.circularDependency = subObject; // osnap!
Reactotron.display({
name: "🔥 IGNITE 🔥",
preview: "You should totally expand this",
value: {
"💃": "Welcome to the future!",
subObject,
"someInlineFunction": () => true,
"someGeneratorFunction": startup,
"someNormalFunction": selectAvatar,
},
});
}
const avatar = yield select(selectAvatar);
// only get if we don't have it yet
if (!is(String, avatar)) {
yield put(GithubActions.userRequest({username: "ascorbic"}));
}
console.display = (name, value, important = false) => Reactotron.display({
name,
value,
important,
});
console.log = (...args) => {
oldConsoleLog(...args);
Reactotron.display({
name: 'CONSOLE.LOG',
important: true,
value: args,
preview:
args.length > 0 && typeof args[0] === 'string' ? args[0] : null,
});
};
};
console.logState = (preview, value) => {
reactotron.display({
name: 'STATE',
preview,
value,
});
};