0
Plz make it true.
17 odpowiedzi
+ 5
Make this your JavaScript code:
navigator.getBattery().then(function(battery) { document.write(battery.level * 100); } )
+ 3
You call it via the promise getBattery returns with a success function to be called when the promise is fulfilled. Basically, battery needs to be looked up so you make a request with getBattery. At some point later, the data becomes available. You use then to say, when it is available call this function.
+ 3
No. That is the method to tell the promise here is my function you should call once you get the data.
+ 2
Make what?
+ 1
Plz if you can Make it true I want a very simple example to underestand
+ 1
Sorry what does ".then" do in this code??
+ 1
I'll get happy if you answer
+ 1
What is then??Can you make an example with that untill O underestand that
+ 1
So can you make a code like that code without .then??
+ 1
would you make .?
+ 1
Ok thanks
+ 1
nothing