aboutsummaryrefslogtreecommitdiff
path: root/files/bn/web/api/battery_status_api/index.html
blob: b75994d3567c81afe0a8e42a28a7dab74297beff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
---
title: Battery Status API
slug: Web/API/Battery_Status_API
translation_of: Web/API/Battery_Status_API
---
<div>{{DefaultAPISidebar("ব্যাটারি API")}}</div>

<p><strong>ব্যাটারি অবস্থা API </strong>টি, প্রায়ই <strong>ব্যাটারি API</strong> হিসাবে বলা হয়, সিস্টেমের ব্যাটারি চার্জ লেভেল সম্পর্কে তথ্য সরবরাহ করে এবং যখন ব্যাটারি লেভেল বা করার অবস্থা পরিবর্তন করা হয় তখন প্রেরিত ইভেন্টগুলি দ্বারা আপনাকে সূচিত করে। ব্যাটারির চার্জ কম থাকলে এটি আপনার অ্যাপের সম্পদ ব্যবহারকে সামঞ্জস্য করে ব্যাটারী নিষ্কাশন কমাতে  বা ডেটা ক্ষতি প্রতিরোধ করার জন্য ব্যাটারি শেষ হত্তয়ার আগে পরিবর্তন সংরক্ষণ করতে  ব্যবহার করা যেতে পারে।</p>

<p>ব্যাটারি অবস্থা API ব্যাটারি প্রতিশ্রুতি ফিরিয়ে আনার একটি {{domxref("navigator.getBattery()")}} মেথড/পদ্ধতিতে {{domxref("window.navigator")}}- কে প্রসারিত করে, যা একটি {{domxref("BatteryManager")}} অবজেক্টে সমাধান করা হয় যা আপনাকে ব্যাটারি অবস্থা নিরীক্ষণ করার জন্য কিছু নতুন ইভেন্টগুলি পরিচালনা করতে পারে.</p>

<h2 id="উদাহরণ">উদাহরণ</h2>

<p>এই উদাহরণে, আমরা চার্জিং অবস্থা (আমরা প্লাগ ইন এবং চার্জিং কিনা তাও) এর ব্যাটারি স্তর এবং সময় পরিবর্তনের উভয় পরিবর্তনগুলির জন্য দেখতে পাই। এটি {{event("chargingchange")}}, {{event("levelchange")}}, {{event("chargingtimechange")}}, {{event("dischargingtimechange")}} ইভেন্টগুলি শোনার মাধ্যমে সম্পন্ন করা হয়।</p>

<pre class="brush: js">navigator.getBattery().then(function(battery) {
  function updateAllBatteryInfo(){
    updateChargeInfo();
    updateLevelInfo();
    updateChargingInfo();
    updateDischargingInfo();
  }
  updateAllBatteryInfo();

  battery.addEventListener('chargingchange', function(){
    updateChargeInfo();
  });
  function updateChargeInfo(){
    console.log("Battery charging? "
                + (battery.charging ? "Yes" : "No"));
  }

  battery.addEventListener('levelchange', function(){
    updateLevelInfo();
  });
  function updateLevelInfo(){
    console.log("Battery level: "
                + battery.level * 100 + "%");
  }

  battery.addEventListener('chargingtimechange', function(){
    updateChargingInfo();
  });
  function updateChargingInfo(){
    console.log("Battery charging time: "
                 + battery.chargingTime + " seconds");
  }

  battery.addEventListener('dischargingtimechange', function(){
    updateDischargingInfo();
  });
  function updateDischargingInfo(){
    console.log("Battery discharging time: "
                 + battery.dischargingTime + " seconds");
  }

});
</pre>

<p>আরো দেখুন <a class="external" href="http://www.w3.org/TR/battery-status/#examples">the example in the specification</a>.</p>

<h2 id="সবিস্তার_বিবরণী">সবিস্তার বিবরণী</h2>

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">সবিস্তার বিবরণী</th>
   <th scope="col">অবস্থা</th>
   <th scope="col">মন্তব্য</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{SpecName("Battery API")}}</td>
   <td>{{Spec2("Battery API")}}</td>
   <td>প্রাথমিক সংজ্ঞা</td>
  </tr>
 </tbody>
</table>

<h2 id="উপযুক্তত_ব্রাউজার">উপযুক্তত ব্রাউজার</h2>

<p>{{CompatibilityTable}}</p>

<div id="compat-desktop">
<table class="compat-table">
 <tbody>
  <tr>
   <th>বৈশিষ্ট্যসূচক</th>
   <th>Chrome</th>
   <th>Firefox (Gecko)</th>
   <th>Internet Explorer</th>
   <th>Opera</th>
   <th>Safari</th>
  </tr>
  <tr>
   <td>মৌলিক সমর্থন</td>
   <td>{{CompatChrome(39.0)}}</td>
   <td>{{CompatGeckoDesktop("10")}} {{property_prefix("moz")}}<br>
    {{CompatGeckoDesktop("16")}}<sup>[1]</sup><br>
    {{CompatGeckoDesktop("43")}}<sup>[3]</sup><br>
    {{CompatGeckoDesktop("52")}}<sup>[4]</sup></td>
   <td>{{CompatNo}}</td>
   <td>25</td>
   <td>{{CompatNo}}</td>
  </tr>
 </tbody>
</table>
</div>

<div id="compat-mobile">
<table class="compat-table">
 <tbody>
  <tr>
   <th>বৈশিষ্ট্যসূচক</th>
   <th>Android</th>
   <th>Android Webview</th>
   <th>Firefox Mobile (Gecko)</th>
   <th>IE Mobile</th>
   <th>Opera Mobile</th>
   <th>Safari Mobile</th>
   <th>Chrome for Android</th>
  </tr>
  <tr>
   <td>মৌলিক সমর্থন</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatChrome(40.0)}}</td>
   <td>
    <p>{{CompatGeckoMobile("10")}} {{property_prefix("moz")}}<br>
     {{CompatGeckoMobile("16")}}<sup>[1]</sup><br>
     {{CompatGeckoMobile("43")}}<sup>[3]</sup><br>
     {{CompatGeckoMobile("52")}}<sup>[3]</sup></p>
   </td>
   <td>{{CompatNo}}</td>
   <td>25<sup>[2]</sup></td>
   <td>{{CompatNo}}</td>
   <td>{{CompatChrome(42.0)}}<sup>[2]</sup></td>
  </tr>
 </tbody>
</table>
</div>

<p>[1] Disabled by default in Firefox 10.0, but can be enabled setting the preference <code>dom.battery.enabled</code> to <code>true</code>. Starting with Firefox 11.0, <code>mozBattery</code> is enabled by default. The ব্যাটারি API is currently supported on Android, Windows, and Linux with UPower installed. Support for MacOS is available starting with Gecko 18.0 {{geckoRelease("18.0")}}. Firefox also provides support for the deprecated {{domxref("navigator.battery")}}.</p>

<p>[2] Values for {{domxref("BatteryManager.chargingTime")}} and {{domxref("BatteryManager.dischargingTime")}} are always equal to <code>Infinity</code>.</p>

<p>[3] The new promise-based syntax for {{domxref("Navigator.getBattery()")}} is supported from Firefox 43 onwards.</p>

<p>[4] From Firefox 52 onwards, the ব্যাটারি অবস্থা API is only available in chrome/privileged code.</p>

<h2 id="আরো_দেখুন">আরো দেখুন</h2>

<ul>
 <li><a href="/en-US/Apps/Build/gather_and_modify_data/retrieving_battery_status_information">Retrieving battery status information - demo &amp; article</a></li>
 <li><a class="external" href="http://hacks.mozilla.org/2012/02/using-the-battery-api-part-of-webapi/">Hacks blog post - Using the Battery API</a></li>
</ul>