-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Editor.run tweaks #4067
base: force
Are you sure you want to change the base?
Editor.run tweaks #4067
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
I'm not used to the options being in front, but seeing it coded up, it does make pause because it does seem more readable. I think then my only concern is if the options is empty in the future, i.e.
So, with that preface being said, and to riff on your idea further, Alex, could the options parameter by, ahem, optional? We can have an overloaded interface where it's: |
it is optional - there's a few examples in there that use plain |
do you mean in Steve's PR? yeah, i get that. |
no i mean here. it's already overloaded & optional: tldraw/packages/editor/src/lib/editor/Editor.ts Lines 1071 to 1082 in 104c0e4
|
i'll add an explicit example of that to the doc comment but the options-less signature is already there |
Couple of changes to editor.run, the main one being the order. Previously, we did
editor.run(fn, opts)
. This sort of makes sense, because options objects usually come last. This diff switched us toeditor.run(opts, fn)
, which I think makes more sense for a few reasons:run
, but we don't know if that run is affecting history/locking until the bottom. having the options first makes things much more readable imorun
call and its options all on one line.Other changes:
run
function._force