Code Monkey home page Code Monkey logo

Comments (4)

touficbatache avatar touficbatache commented on August 13, 2024 4

Ok, so to wrap everything up, add the following script in your js file like so:

document.addEventListener("deviceready", function() {
    WifiWizard2.scan().then( function( results ){
        // Whatever you want with results
        console.log(results);
    });
}, false);

I'd really like to see a warning in the README file that says that the code should be wrapped inside the deviceready event listener like so:
document.addEventListener("deviceready", function() { // The code here }, false);
and also an example for listing the wifi networks like so:
console.log(results);

Very good work on supporting this library! Was very happy to see it at very but a little more upset when I couldn't get it to work, so that's why I suggested adding examples to your README file.

from wifiwizard2.

touficbatache avatar touficbatache commented on August 13, 2024

I'm debugging the app and it seems like WifiWizard2 is not defined in the cordova.js file. Any ideas on this? The WifiWizard2.js file is here and it's available in the cordova_plugins.js file.

from wifiwizard2.

touficbatache avatar touficbatache commented on August 13, 2024

Ok, I made it work but after changing the code to this:

WifiWizard2.scan().then( function( results ){
    console.log( 'Found networks', results );
})

However, I need to run it from the console in Chrome. Should I put the async tag on the <script> tag containing the js files?

The readme.md file doesn't help at all when it comes to using this plugin. Please add an example to each function, it would be very very helpful! Thanks!

from wifiwizard2.

tripflex avatar tripflex commented on August 13, 2024

@touficbatache there is a link to a complete demo meteor project using this library, the 3.0.0 branch readme is completely different from master branch (ill be merging it soon since it appears 3.0.0 may be more stable now than the original one).

And yes, you're correct, you can't run any Cordova related API calls until deviceready, this is true for anything Cordova related:
https://cordova.apache.org/docs/en/latest/cordova/events/events.html#deviceready

i guess if you're trying to immediately invoke on the page loading (which I personally don't really ever do, it's always triggered by some kind action in the app), but I will add something in the readme stating this

from wifiwizard2.

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.