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

Replace onStart/Stop with more natural .run(fn, ctx) #19

Open
johnd0e opened this issue Feb 2, 2021 · 0 comments
Open

Replace onStart/Stop with more natural .run(fn, ctx) #19

johnd0e opened this issue Feb 2, 2021 · 0 comments

Comments

@johnd0e
Copy link
Contributor

johnd0e commented Feb 2, 2021

Proposed syntax:

			var hand = new Hand({timing: 'fastframe'});
			var mouse = hand.growFinger('mouse');
			mouse.wait(100).moveTo(200, 200, 0)
				.down().moveBy(5, 0, 20).moveBy(256, 32, 200).up()
				.run(function (hand) {
					happen.click(container);
					expect(dragSpy.called).to.be(true);
					expect(clickSpy.called).to.be(false);
					expect(preclickSpy.called).to.be(false);
					done();
				});

Compare with current style: https://github.com/Leaflet/Leaflet/blob/436430db4203a350601e002c8de6a41fae15a4bf/spec/suites/map/handler/Map.DragSpec.js#L173-L191

Advantages:

  • no need for separate onStart/onStop properties
  • it's possible to insert (any numbers of) calls in arbitrary steps of events sequence
  • it is more convenient and looks more natural
@johnd0e johnd0e changed the title Replace onStart/Stop with more natural .call(fn, ctx) Replace onStart/Stop with more natural .run(fn, ctx) Feb 2, 2021
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