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

Can we add some concrete examples for JavaScript initializers in this page? #26363

Closed
javiercn opened this issue Jul 8, 2022 · 2 comments · Fixed by #28492
Closed

Can we add some concrete examples for JavaScript initializers in this page? #26363

javiercn opened this issue Jul 8, 2022 · 2 comments · Fixed by #28492

Comments

@javiercn
Copy link
Member

javiercn commented Jul 8, 2022

[EDIT by guardrex to change the metadata to point to the Startup topic, where we can place the examples with existing ones.]

Examples are:

  • Ensuring that your library is loaded before Blazor Starts.
  • Automatically loading the scripts that your library needs.
  • Ensuring that Blazor has been initialized before calling into it from your library.

Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

@dotnet-bot dotnet-bot added Blazor Source - Docs.ms Docs Customer feedback via GitHub Issue labels Jul 8, 2022
@guardrex guardrex self-assigned this Jul 8, 2022
@guardrex
Copy link
Collaborator

guardrex commented Jul 8, 2022

I'm changing the metadata for this b/c this was classified as a fundamental startup concept and placed in the Startup doc at ...

https://docs.microsoft.com/en-us/aspnet/core/blazor/fundamentals/startup?view=aspnetcore-6.0#javascript-initializers

... which is cross-linked from the JS interop topic. I think I'll adjust the cross-link to make it more obvious in the JS interop overview section.

We'll add the scenario examples to the Startup topic.

... and there's an orphan scenario that could either be moved or doubled in an INCLUDE file to appear in both places ...

https://docs.microsoft.com/en-us/aspnet/core/blazor/javascript-interoperability/?view=aspnetcore-6.0#inject-a-script-after-blazor-starts

Note to self: I've isolated a group of PU repo dev issues that pertain to this. See YOUR 🦖 "JSinit #26363" bookmark folder!

@guardrex guardrex removed the Source - Docs.ms Docs Customer feedback via GitHub Issue label Oct 28, 2022
@guardrex guardrex added Pri1 and removed Pri2 labels Jan 10, 2023
@guardrex
Copy link
Collaborator

guardrex commented Feb 16, 2023

I'm going to place my notes here and mark this back off of In progress to P1 until I get a clearer understanding for each ask. Right now, here are the directions that I was thinking ...

  1. Ensuring that your library is loaded before Blazor Starts.

    Covered by loading a script in beforeStart.

  2. Automatically loading the scripts that your library needs.

    Load them in order in beforeStart.

    Do you want to add the approach for modules of using an import statement ... and if so ...

    (a) What should the doc say about adding an import statement to the top of the *.lib.module.js file? ... anything in particular about it?

    (b) Using a dynamic import({MODULE PATH}); statement within beforeStart? ... anything in particular?

  3. Ensuring that Blazor has been initialized before calling into it from your library.

    This doesn't just mean calling the library's initialization FN from afterStarted? I guess I'm not clear on where/when you mean for the "calling into it" part of that.

  4. Another ? ...

    Does the IIFE pattern play a role in any JS initializer scnearios?

  5. Another ? ...

    Should the guidance state that it's OK for a dev to export custom JS FNs from within the *.lib.module.js file SxS with beforeStart/afterStarted?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants