|
11 | 11 | "code": "structuredClone(value, transferables)" |
12 | 12 | } |
13 | 13 | ] |
| 14 | + }, |
| 15 | + { |
| 16 | + "title": "Geolocation API", |
| 17 | + "items": [ |
| 18 | + { |
| 19 | + "definition": "Geolocation API সাপোর্ট আছে কিনা চেক করা", |
| 20 | + "code": "if (navigator.geolocation) { /* Supported */ }" |
| 21 | + }, |
| 22 | + { |
| 23 | + "definition": "ইউজারের বর্তমান অবস্থান পাওয়া", |
| 24 | + "code": "navigator.geolocation.getCurrentPosition(success, error, options);" |
| 25 | + }, |
| 26 | + { |
| 27 | + "definition": "সফল হলে কলব্যাক ফাংশন", |
| 28 | + "code": "function success(position) { const { latitude, longitude } = position.coords; }" |
| 29 | + }, |
| 30 | + { |
| 31 | + "definition": "ত্রুটি হ্যান্ডেল করার ফাংশন", |
| 32 | + "code": "function error(err) { console.log(`Error: ${err.message}`); }" |
| 33 | + }, |
| 34 | + { |
| 35 | + "definition": "অপশনাল অপশন সেট করা", |
| 36 | + "code": "const options = { enableHighAccuracy: true, timeout: 5000, maximumAge: 0 };" |
| 37 | + }, |
| 38 | + { |
| 39 | + "definition": "ইউজারের অবস্থান পরিবর্তন হলে ট্র্যাক করা (watch)", |
| 40 | + "code": "const watchId = navigator.geolocation.watchPosition(success, error, options);" |
| 41 | + }, |
| 42 | + { |
| 43 | + "definition": "ট্র্যাকিং বন্ধ করা", |
| 44 | + "code": "navigator.geolocation.clearWatch(watchId);" |
| 45 | + }, |
| 46 | + { |
| 47 | + "definition": "position অবজেক্টে থাকা প্রপার্টিজ", |
| 48 | + "code": "position.coords.latitude, position.coords.longitude, position.coords.accuracy" |
| 49 | + } |
| 50 | + ] |
14 | 51 | } |
| 52 | + |
| 53 | + |
15 | 54 | ] |
16 | 55 | } |
0 commit comments