forked from devsonket/devsonket.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjs-web-api.json
More file actions
55 lines (53 loc) · 2.68 KB
/
Copy pathjs-web-api.json
File metadata and controls
55 lines (53 loc) · 2.68 KB
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
{
"id": "js-web-api",
"title": "জাভাস্ক্রিপ্ট ওয়েব এপিআই",
"slug": "js-web-api",
"description": "জাভাস্ক্রিপ্ট এর প্রয়োজনীয় কিছু ওয়েব এপিআই",
"colorPref": "#f0db4f",
"contents": [{
"title": "ইন্টারফেসেস",
"items": [{
"definition": "একটা অবজেক্ট ডিপ ক্লোন করার জন্য [optional = transferables]",
"code": "structuredClone(value, transferables)"
}
]
},
{
"title": "Geolocation API",
"items": [
{
"definition": "Geolocation API সাপোর্ট আছে কিনা চেক করা",
"code": "if (navigator.geolocation) { /* Supported */ }"
},
{
"definition": "ইউজারের বর্তমান অবস্থান পাওয়া",
"code": "navigator.geolocation.getCurrentPosition(success, error, options);"
},
{
"definition": "সফল হলে কলব্যাক ফাংশন",
"code": "function success(position) { const { latitude, longitude } = position.coords; }"
},
{
"definition": "ত্রুটি হ্যান্ডেল করার ফাংশন",
"code": "function error(err) { console.log(`Error: ${err.message}`); }"
},
{
"definition": "অপশনাল অপশন সেট করা",
"code": "const options = { enableHighAccuracy: true, timeout: 5000, maximumAge: 0 };"
},
{
"definition": "ইউজারের অবস্থান পরিবর্তন হলে ট্র্যাক করা (watch)",
"code": "const watchId = navigator.geolocation.watchPosition(success, error, options);"
},
{
"definition": "ট্র্যাকিং বন্ধ করা",
"code": "navigator.geolocation.clearWatch(watchId);"
},
{
"definition": "position অবজেক্টে থাকা প্রপার্টিজ",
"code": "position.coords.latitude, position.coords.longitude, position.coords.accuracy"
}
]
}
]
}