Simpler demo
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 48/100
- Issue type
- Documentation
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- javascript, sqlite
- Domain
- documentation
Research direction
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.
Written by the indexing model from the issue text.
Description
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>
- Dominant language
- JavaScript
- Stars
- 13.7k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from sql-js/sql.js
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
HarperFast/skills#96 ·
-
[Block] Latest Posts [Type] Bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
sugarlabs/musicblocks#8847 ·