Skip to content

Debug events#3005

Merged
Rich-Harris merged 10 commits intosveltejs:masterfrom
RedHatter:devtools
Sep 9, 2019
Merged

Debug events#3005
Rich-Harris merged 10 commits intosveltejs:masterfrom
RedHatter:devtools

Conversation

@RedHatter
Copy link
Copy Markdown
Contributor

@RedHatter RedHatter commented Jun 11, 2019

This pull request causes code bundles generated with the dev flag on to emit events on document when various things happen.

  • Blocks are created
  • Components classes are created
  • Any DOM multiplication

It also adds a Component.$unsafe_set function that allows any state to be set from outside of the component.

This would open up the possibility for tools to be created that "plug into" svelte. One such tools is Svelte DevTools that I've been working on. Another might be a svelte aware testing framework.

See also #2931

RedHatter pushed a commit to sveltejs/svelte-devtools that referenced this pull request Jun 11, 2019
RedHatter pushed a commit to sveltejs/svelte-devtools that referenced this pull request Jun 14, 2019
@RedHatter RedHatter changed the title Devtools Debug events Jun 15, 2019
@RedHatter
Copy link
Copy Markdown
Contributor Author

@Rich-Harris Not to be a bother, but any chance you can review this sometime soon? I can't move forward with svelte-devtools without it.

@codecov-io
Copy link
Copy Markdown

codecov-io commented Sep 9, 2019

Codecov Report

Merging #3005 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3005   +/-   ##
=======================================
  Coverage   50.25%   50.25%           
=======================================
  Files           1        1           
  Lines         197      197           
=======================================
  Hits           99       99           
  Misses         98       98

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e686216...f2568f6. Read the comment docs.

@Rich-Harris
Copy link
Copy Markdown
Member

Thanks so much for this PR, and sincere apologies for the length of time it's taken to review it (once the PR backlog grows past a certain size I fall into the trap of prioritising 'quick wins' and urgent bug fixes over more structural things that require more attention. I know that's annoying for everyone else, and I'm trying to get better at it 😬).

This all looks great to me. I've brought it up to date with the current master. I made one change — since merging #3148 we now have an $inject_state method which is very similar to $unsafe_set. There was just one small behavioural difference ($inject_state only updates state that can change, whereas for devtools $unsafe_set could change all writable variables), so I've updated $inject_state to behave more like $unsafe_set, and removed the latter (cc @Axelen123)

If you're good with that change, then I believe this is ready to merge.

@RedHatter
Copy link
Copy Markdown
Contributor Author

Looks great. Thanks for the review

@Rich-Harris Rich-Harris merged commit 3d0a3cd into sveltejs:master Sep 9, 2019
@Rich-Harris
Copy link
Copy Markdown
Member

Perfect — released 3.12.0. Thanks again

Perseus-rescuer added a commit to Perseus-rescuer/Eshop-Svelte that referenced this pull request Nov 14, 2024
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

Successfully merging this pull request may close these issues.

3 participants