better naming

pull/16131/head
Rich Harris 3 months ago
parent 80137f2ee7
commit 0c66da79fa

@ -14,7 +14,7 @@ export let tracing_expressions = null;
* @param {Error[]} [traces] * @param {Error[]} [traces]
*/ */
function log_entry(signal, traces = []) { function log_entry(signal, traces = []) {
const debug = signal.debug; const debug = signal.trace;
const value = signal.trace_need_increase ? signal.trace_v : signal.v; const value = signal.trace_need_increase ? signal.trace_v : signal.v;
if (value === UNINITIALIZED) { if (value === UNINITIALIZED) {

@ -527,7 +527,7 @@ function create_item(
if (DEV && reactive) { if (DEV && reactive) {
// For tracing purposes, we need to link the source signal we create with the // For tracing purposes, we need to link the source signal we create with the
// collection + index so that tracing works as intended // collection + index so that tracing works as intended
/** @type {Value} */ (v).debug = () => { /** @type {Value} */ (v).trace = () => {
var collection_index = typeof i === 'number' ? index : i.v; var collection_index = typeof i === 'number' ? index : i.v;
// eslint-disable-next-line @typescript-eslint/no-unused-expressions // eslint-disable-next-line @typescript-eslint/no-unused-expressions
get_collection()[collection_index]; get_collection()[collection_index];

@ -66,7 +66,7 @@ export function source(v, stack) {
if (DEV && tracing_mode_flag) { if (DEV && tracing_mode_flag) {
signal.created = stack ?? get_stack('CreatedAt'); signal.created = stack ?? get_stack('CreatedAt');
signal.debug = null; signal.trace = null;
} }
return signal; return signal;

@ -22,7 +22,7 @@ export interface Value<V = unknown> extends Signal {
trace_need_increase?: boolean; trace_need_increase?: boolean;
trace_v?: V; trace_v?: V;
label?: string; label?: string;
debug?: null | (() => void); trace?: null | (() => void);
} }
export interface Reaction extends Signal { export interface Reaction extends Signal {

@ -780,8 +780,8 @@ export function get(signal) {
tracing_expressions.reaction === active_reaction tracing_expressions.reaction === active_reaction
) { ) {
// Used when mapping state between special blocks like `each` // Used when mapping state between special blocks like `each`
if (signal.debug) { if (signal.trace) {
signal.debug(); signal.trace();
} else { } else {
var trace = get_stack('TracedAt'); var trace = get_stack('TracedAt');

Loading…
Cancel
Save