Skip to content

Commit 9bb34db

Browse files
committed
wip
1 parent a28abd8 commit 9bb34db

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

packages/signals/signals/src/core/emitter/index.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,27 @@ export interface EmitSignal {
66
emit: (signal: Signal) => void
77
}
88

9+
const logSignal = (signal: Signal) => {
10+
logger.info(
11+
'New signal:',
12+
signal.type,
13+
signal.data,
14+
signal.type === 'interaction'
15+
? {
16+
value: signal.data.target.value,
17+
changedAttribute: signal.data.target.changedAttribute,
18+
changedValue: signal.data.target.changedValue,
19+
}
20+
: undefined
21+
)
22+
}
23+
924
export class SignalEmitter implements EmitSignal {
1025
private emitter = new Emitter<{ add: [Signal] }>()
1126
private listeners = new Set<(signal: Signal) => void>()
1227

1328
emit(signal: Signal) {
14-
logger.info('New signal:', signal.type, signal.data)
29+
logSignal(signal)
1530
this.emitter.emit('add', signal)
1631
}
1732

packages/signals/signals/src/core/signal-generators/dom-gen/dom-gen.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -272,9 +272,7 @@ export class OnChangeGenerator implements SignalGenerator {
272272
changedValue: ev.newValue,
273273
changedAttribute: ev.attributeName,
274274
},
275-
metadata: {
276-
listener: 'mutation-observer',
277-
},
275+
listener: 'mutation-observer',
278276
})
279277
)
280278
})
@@ -296,9 +294,7 @@ export class OnChangeGenerator implements SignalGenerator {
296294
changedValue: el.value,
297295
changedAttribute: 'value',
298296
},
299-
metadata: {
300-
listener: 'on-change',
301-
},
297+
listener: 'on-change',
302298
})
303299
)
304300
}, 300)

0 commit comments

Comments
 (0)