4

I have created many snippets in the Chrome devtool's "Elements > Snippets" panel.

I have a snippet with utility functions like loadJquery, loadUnderscore, etc. I would like to call these functions from another snippet. Is this possible?

2 Answers 2

6

Came here cause I struggle with the same question.

I think the correct answer would be yes, if you run each one of them individually and in dependency order.

For example, I have a snippet with a pickDeep() functionality that I got from here. And then I created some other snippets which use that function. So what I do is just run the one with the pickDeep() declaration first, and then run any other snippet which use it.

It's the exact same thing as if you had typed and run everything on the console directly. So it does not matter where the declaration comes from, as long as it has been declared some way in the current session.

Of course is not the desirable way, but I want to point out there is a workaround.

Sign up to request clarification or add additional context in comments.

2 Comments

I can confirm this workaround, thanks for point it out. It helped me still in 2024
@DavidePedron I'm glad it was helpful!
5

No, snippets have no knowledge of other snippets nor is there a way to query them up. Snippets are isolated scripts that work independently of each other.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.