REACTNATIVE MOBİL APK OLUŞTURMA
1 2 3 4 5 6 7 8 9 10 |
windows PowerShell Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) C:\Windows\system32> choco install -y nodejs.install openjdk8 ------ npm install --global expo-cli expo init my-project Cd my-project run android expo start expo init Kuran Hikmet |
Mark işaretleme sarı renkli
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 |
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js" integrity="sha512-894YE6QWD5I59HgZOGReFYm4dnWc1Qt5NtvYSaNcOP+u1T9qYdvdihz0PPSiiqn/+/3e7Jo4EaG7TubfWGUrMQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script> <script src="https://cdn.jsdelivr.net/mark.js/8.6.0/jquery.mark.min.js" ></script> <style> mark { padding: 0; background-color:yellow; } mark.secondary { padding: 0; background-color: orange; } </style> </head> <body> <input type="text" name="keyword"> <div class="context"> Korkma, sönmez bu şafaklarda yüzen al sancak; <br> Sönmeden yurdumun üstünde tüten en son ocak. <br> O benim milletimin yıldızıdır, parlayacak; <br> O benimdir, o benim milletimindir ancak. <br> <br> Çatma, kurban olayım çehreni ey nazlı hilâl! <br> Kahraman ırkıma bir gül… ne bu şiddet bu celâl? <br> Sana olmaz dökülen kanlarımız sonra helâl, <br> </div> <script> $(function() { var mark = function() { // Read the keyword var keyword = $("input[name='keyword']").val(); // Remove previous marked elements and mark // the new keyword inside the context $(".context, .context2").unmark({ done: function() { $(".context, .context2").mark(keyword); } }); }; $("input[name='keyword']").on("input", mark); }); </script> </body> </html> |
Mark Javascript
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 |
<!--- coding by codegyan - codegyan.in --> <!DOCTYPE html> <html lang="tr"> <head> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Highlight Searched Text</title> <!--Google Font--> <link href="https://fonts.googleapis.com/css2?family=Rubik&display=swap" rel="stylesheet"> <!--Stylesheet--> <style> *{ padding: 0; margin: 0; box-sizing: border-box; font-family: "Rubik",sans-serif; } body{ height: 100%; background: linear-gradient( to right, #201d2e 50%, #f6f6f6 50% ) fixed; } .container{ width: 90vmin; background-color: #ffffff; padding: 50px 40px; position: absolute; transform: translate(-50%,-50%); top: 50%; left: 50%; border-radius: 5px; box-shadow: 0 20px 35px rgba(60,60,60,0.2); } .wrapper{ display: flex; justify-content: space-between; } .wrapper input{ width: 60%; padding: 10px 5px; border-radius: 3px; border: 1px solid #201d2e; } .wrapper button{ width: 30%; background-color: #201d2e; border: none; outline: none; cursor: pointer; color: #ffffff; border-radius: 3px; } .container p{ line-height: 35px; text-align: justify; margin-top: 30px; } mark{ background-color: #ffdd4b; } </style> </head> <body> <div class="container"> <div class="wrapper"> <input type="text" id="text-to-search" placeholder="Enter text to search.."> <button onclick="search()">Search</button> </div> <p id="paragraph"> He ordered his regular breakfast. Two eggs sunnyside up, hash browns, and two strips of bacon. He continued to look at the menu wondering if this would be the day he added something new. This was also part of the routine. A few seconds of hesitation to see if something else would be added to the order before demuring and saying that would be all. It was the same exact meal that he had ordered every day for the past two years. </p> </div> <script> // Characters to be escaped [.*+?^${}()|[\]\\] function search(){ let textToSearch = document.getElementById("text-to-search").value; let paragraph = document.getElementById("paragraph"); textToSearch = textToSearch.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"); let pattern = new RegExp(`${textToSearch}`,"gi"); paragraph.innerHTML = paragraph.textContent.replace(pattern, match => `<mark>${match}</mark>`) } </script> </body> </html> |
3 Asenkron olayı
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
$(document).ready(function () { // BAŞARILI function basla(albesmele){ fetch(yollar + "/tamKuranYukle") .then(data => data.json()) .then(veriler => { tam = veriler; console.log(tam) albesmele() }) } function besmele(){ console.log("BİSMİLLAH") } basla(besmele); }) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
$(document).ready(function () { //BAŞARILI async function basla(){ await fetch(yollar + "/tamKuranYukle") .then(data => data.json()) .then(veriler => { tam = veriler; console.log(tam) }) console.log("BİSMİLLAH İLE") //besmele(); } function besmele(){ console.log("BİSMİLLAH") } basla(); }) |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
const test = async () => { await new Promise((resolve)=>setTimeout(() => { console.log("timeout"); resolve(); }, 2000)); console.log(1); console.log(2); } test(); |
Javascript Callback, promise and await örnekleri
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 |
//Dummy data const data = [ { title: "Title 1", description: "Title Content 1" }, { title: "Title 2", description: "Title Content 2" } ] //Example Callback function getData() { setTimeout(() => { data.map((item, index) => { console.log('getData', item, index) }) }, 1000); } function createData(newData, callback) { setTimeout(() => { data.push(newData); callback() }, 2000); } createData({ title: "Title 3", description: "Title Content 3" }, getData); //Example Promise function createData(post) { return new Promise((resolve, reject) => { data.push(post) const error = false; if (!error) { resolve() } else { reject("Bir hata var!") } }) } createData({ title: "Title 3", description: "Title Content 3" }) .then(getData) .catch(err => console.log("createData Error ->", err)) //Example async async function init(){ await createData({ title: "Title 3", description: "Title Content 3" }), getData() } init () |
async Bu şekilde çalıştı elhamdülillah
1 2 3 4 5 6 7 8 9 10 11 12 |
async function bir(){ await fetch('deney.json') .then(response => response.json()) .then(data => { isim =data.kimlik[0].ad; console.log("1. "+isim); }); console.log("2. SELAM VE DUA "); } bir() |
BU ÇALIŞIYOR
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 |
function ornek1(){ const promise = new Promise((resolve, reject) => { const test =true; setTimeout(() => { if(test) { console.log("Hey, Merhaba Nasılsın."); resolve(); } else { reject("hata!"); } }, 2000); }); function selamla1(){ console.log("Teşekkür Ederim İyiyim Ya Sen!"); } promise.then((data) => { console.log("SAV"); selamla1(); }) .catch((error) => { console.log(error); }); } |
BÖYLE DE OLUR
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 |
function selamla() { return new Promise((resolve, reject) => { const test =true; setTimeout(() => { if(test) { console.log("Hey, Merhaba Nasılsın."); resolve(); } else { reject("hata!"); } }, 2000); }); } function selamla1(){ console.log("Teşekkür Ederim İyiyim Ya Sen!"); } selamla() .then((data) => { selamla1(); }) .catch((error) => { console.log(error); }); |
BU DA SIRALI
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
function sayi(data) { return new Promise((resolve, reject) => { if (data < 800) resolve(data * 5); else reject('sonuç 800 den küçük sayıları çarp'); }); } sayi(2).then((data)=>{ console.log(data); return sayi(data); }).then((data)=>{ console.log(data); return sayi(data); }).then((data)=>{ console.log(data); return sayi(data); }).then((data)=>{ console.log(data); return sayi(data); }).catch((err)=>{ console.log(err); }); |
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 |
function promise(){ const elma = () => { return new Promise((resolve, reject) => { var x = 20 var y=30 var t = x+y resolve("sav "+ t); }) } elma() .then((data) => { console.log(data); }) .then(() => { console.log("2"); }) .then(() => { console.log("3"); }) .then(() => { console.log("4"); }) } |