Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad smell in BlEvent class-side API and class references #650

Open
tinchodias opened this issue Nov 19, 2024 · 0 comments
Open

Bad smell in BlEvent class-side API and class references #650

tinchodias opened this issue Nov 19, 2024 · 0 comments

Comments

@tinchodias
Copy link
Collaborator

There is API in class-side of BlEvent to dispatch instances of event. At least, I wonder why this is class-side and not instance-side:

Screenshot 2024-11-19 at 17 54 33

References to the class to make use of such API:

In BlEvent>>#fire:

fire
	BlEvent fireEvent: self

In BlBaseEventProcessor>>#fireEvent::

fireEvent: anEvent
	^ BlEvent fireEvent: anEvent

In BlBaseEventProcessor>>#fireEvent:from::

fireEvent: anEvent from: aTopEventTarget
	^ BlEvent fireEvent: anEvent from: aTopEventTarget

In BlDevScripterFireEventStep>>#playOn::

playOn: aScripter
	| aTarget |
	aTarget := self target findTargetStartingInScripter: aScripter.
	self position updateEventPosition: self event in: aTarget.
	BlEvent fireEvent: self event target: aTarget.
	aScripter pulse.

In BlDevScripterShortcutStep>>#playOn::

playOn: aScripter
	| aTarget aBuffer anEvent |
	aTarget := self target findTargetStartingInScripter: aScripter.
	
	aBuffer := BlKeyboardBuffer new.
	combination asBufferKeys do: [ :eachKeyboardKey | aBuffer add: (BlKeyDownEvent new key: eachKeyboardKey) ].

	anEvent := BlShortcutEvent new
		buffer: aBuffer.

	BlEvent fireEvent: anEvent target: aTarget.

	aScripter pulse
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant