Git Product home page Git Product logo

Comments (2)

diegogurpegui avatar diegogurpegui commented on June 28, 2024

By default, for the way the addon is develop at this moment, the scripts that load the addon are loaded after the page completed to load.
Specifically, the file that creates the window.nostr object is this nostr-provider.js, which is injected here content-script.js. According to https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/content_scripts we could configure the manifest.json so that the addon content scripts file loads while the page is loading (that is, earlier) by specifying run_at: 'document_start'. But the behavior should be properly tested.

Having said that, what you want is some kind of notification or event once the window.nostr is ready to use, right? As you detected, there's nothing like that yet because the addon behaves mainly as a reactive extenstion.
You can try and modifiy this extension so after having everything ready it fires some event. Otherwise I would suggest you implement some timed logic after the page loads. For example, after the page loads you wait a few seconds and keep looking for window.nostr until it's there.

I'll keep this in mind to add something in the future. But happy to accept a PR if you want to add it.

from nos2x-fox.

diegogurpegui avatar diegogurpegui commented on June 28, 2024

Did you make progress on this @donpdonp ?

from nos2x-fox.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.