Simpler demo
Aperta
Nessuno ha ancora preso questa issue.
- Lingua principale
- JavaScript
- Stelle
- 13.7k
- Fork
- 1.1k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
The sample demo in the readme seems intimidating...
Here's a simpler one:
<head>
<title>Demo</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/sql.js/1.12.0/sql-wasm.js"></script>
<!-- preload sql-wasm.wasm, if you like -->
</head>
<body>
<button id='btn'>Run query</button>
<script type='module'>
// Initialize SQL.js
const SQL = await initSqlJs({
locateFile: () => `https://cdnjs.cloudflare.com/ajax/libs/sql.js/1.12.0/sql-wasm.wasm`
})
// Create a db with sample data
const db = new SQL.Database()
db.run(`CREATE TABLE test (id INTEGER, name TEXT); INSERT INTO test VALUES (1, 'Alice'), (2, 'Bob')`)
// Run a query
async function run() {
const result = await db.exec("SELECT * FROM test")
console.log(result[0].values)
}
btn.addEventListener('click', run)
</script>
</body>
For previous versions:
<head>
<title>Demo</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/sql.js/0.5.0/js/sql-optimized.js"></script>
</head>
<body>
<button id='btn'>Run query</button>
<script type='module'>
const db = new SQL.Database()
db.run(`CREATE TABLE test (id INTEGER, name TEXT); INSERT INTO test VALUES (1, 'Alice'), (2, 'Bob')`)
async function run() {
const result = await db.exec("SELECT * FROM test")
console.log(result[0].values)
}
btn.addEventListener('click', run)
</script>
</body>
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Open the README and find the current sample demo. Replace or revise it using the simpler JavaScript and SQL.js example in the issue, while retaining the previous-version example if it is useful. Done means the README presents the proposed browser demo accurately and its code is readable and runnable.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript, sqlite
- Ambito
- documentation
- Tipo di issue
- Documentazione
- Difficoltà
- 1/5
- Tempo stimato
- Meno di un'ora
- Stato di attività
- Ferma
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 48/100