@instantdb/react
Advanced tools
Comparing version 0.7.5 to 0.7.6
@@ -29,2 +29,25 @@ /// <reference types="react" /> | ||
getLocalId: (name: string) => Promise<string>; | ||
/** | ||
* Use this to write data! You can create, update, delete, and link objects | ||
* | ||
* @see https://docs.instantdb.com/docs/instaml | ||
* | ||
* @example | ||
* // Create a new object in the `goals` namespace | ||
* const goalId = id(); | ||
* db.transact(tx.goals[goalId].update({title: "Get fit"})) | ||
* | ||
* // Update the title | ||
* db.transact(tx.goals[goalId].update({title: "Get super fit"})) | ||
* | ||
* // Delete it | ||
* db.transact(tx.goals[goalId].delete()) | ||
* | ||
* // Or create an association: | ||
* todoId = id(); | ||
* db.transact([ | ||
* tx.todos[todoId].update({ title: 'Go on a run' }), | ||
* tx.goals[goalId].link({todos: todoId}), | ||
* ]) | ||
*/ | ||
transact: (chunks: TransactionChunk | TransactionChunk[]) => void; | ||
@@ -31,0 +54,0 @@ /** |
@@ -52,2 +52,25 @@ "use strict"; | ||
}; | ||
/** | ||
* Use this to write data! You can create, update, delete, and link objects | ||
* | ||
* @see https://docs.instantdb.com/docs/instaml | ||
* | ||
* @example | ||
* // Create a new object in the `goals` namespace | ||
* const goalId = id(); | ||
* db.transact(tx.goals[goalId].update({title: "Get fit"})) | ||
* | ||
* // Update the title | ||
* db.transact(tx.goals[goalId].update({title: "Get super fit"})) | ||
* | ||
* // Delete it | ||
* db.transact(tx.goals[goalId].delete()) | ||
* | ||
* // Or create an association: | ||
* todoId = id(); | ||
* db.transact([ | ||
* tx.todos[todoId].update({ title: 'Go on a run' }), | ||
* tx.goals[goalId].link({todos: todoId}), | ||
* ]) | ||
*/ | ||
this.transact = (chunks) => { | ||
@@ -54,0 +77,0 @@ return this._core.transact(chunks); |
@@ -29,2 +29,25 @@ /// <reference types="react" /> | ||
getLocalId: (name: string) => Promise<string>; | ||
/** | ||
* Use this to write data! You can create, update, delete, and link objects | ||
* | ||
* @see https://docs.instantdb.com/docs/instaml | ||
* | ||
* @example | ||
* // Create a new object in the `goals` namespace | ||
* const goalId = id(); | ||
* db.transact(tx.goals[goalId].update({title: "Get fit"})) | ||
* | ||
* // Update the title | ||
* db.transact(tx.goals[goalId].update({title: "Get super fit"})) | ||
* | ||
* // Delete it | ||
* db.transact(tx.goals[goalId].delete()) | ||
* | ||
* // Or create an association: | ||
* todoId = id(); | ||
* db.transact([ | ||
* tx.todos[todoId].update({ title: 'Go on a run' }), | ||
* tx.goals[goalId].link({todos: todoId}), | ||
* ]) | ||
*/ | ||
transact: (chunks: TransactionChunk | TransactionChunk[]) => void; | ||
@@ -31,0 +54,0 @@ /** |
@@ -47,2 +47,25 @@ var _a; | ||
}; | ||
/** | ||
* Use this to write data! You can create, update, delete, and link objects | ||
* | ||
* @see https://docs.instantdb.com/docs/instaml | ||
* | ||
* @example | ||
* // Create a new object in the `goals` namespace | ||
* const goalId = id(); | ||
* db.transact(tx.goals[goalId].update({title: "Get fit"})) | ||
* | ||
* // Update the title | ||
* db.transact(tx.goals[goalId].update({title: "Get super fit"})) | ||
* | ||
* // Delete it | ||
* db.transact(tx.goals[goalId].delete()) | ||
* | ||
* // Or create an association: | ||
* todoId = id(); | ||
* db.transact([ | ||
* tx.todos[todoId].update({ title: 'Go on a run' }), | ||
* tx.goals[goalId].link({todos: todoId}), | ||
* ]) | ||
*/ | ||
this.transact = (chunks) => { | ||
@@ -49,0 +72,0 @@ return this._core.transact(chunks); |
{ | ||
"name": "@instantdb/react", | ||
"version": "0.7.5", | ||
"version": "0.7.6", | ||
"description": "Instant DB for React", | ||
@@ -32,4 +32,4 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@instantdb/core": "0.7.5" | ||
"@instantdb/core": "0.7.6" | ||
} | ||
} |
@@ -87,2 +87,25 @@ import { | ||
/** | ||
* Use this to write data! You can create, update, delete, and link objects | ||
* | ||
* @see https://docs.instantdb.com/docs/instaml | ||
* | ||
* @example | ||
* // Create a new object in the `goals` namespace | ||
* const goalId = id(); | ||
* db.transact(tx.goals[goalId].update({title: "Get fit"})) | ||
* | ||
* // Update the title | ||
* db.transact(tx.goals[goalId].update({title: "Get super fit"})) | ||
* | ||
* // Delete it | ||
* db.transact(tx.goals[goalId].delete()) | ||
* | ||
* // Or create an association: | ||
* todoId = id(); | ||
* db.transact([ | ||
* tx.todos[todoId].update({ title: 'Go on a run' }), | ||
* tx.goals[goalId].link({todos: todoId}), | ||
* ]) | ||
*/ | ||
transact = (chunks: TransactionChunk | TransactionChunk[]) => { | ||
@@ -260,21 +283,24 @@ return this._core.transact(chunks); | ||
</span> | ||
${data | ||
? ` | ||
${ | ||
data | ||
? ` | ||
<div> | ||
<strong>State:</strong> ${data.state.isLoading ? "Loading" : data.state.error ? "Error" : "OK" | ||
} | ||
<strong>State:</strong> ${ | ||
data.state.isLoading ? "Loading" : data.state.error ? "Error" : "OK" | ||
} | ||
</div> | ||
<div> | ||
${data.state.data | ||
? ` | ||
${ | ||
data.state.data | ||
? ` | ||
<strong>Data</strong> | ||
<pre class="_idb-code">${JSON.stringify(data.state.data, null, 2)}</pre> | ||
` | ||
: data.state.error | ||
? ` | ||
: data.state.error | ||
? ` | ||
<strong>Error</strong> | ||
<pre class="_idb-code">${JSON.stringify(data.state.error, null, 2)}</pre> | ||
` | ||
: "" | ||
} | ||
: "" | ||
} | ||
</div> | ||
@@ -286,4 +312,4 @@ <div> | ||
` | ||
: `<em>Hover your cursor over an element to inspect it's data.</em>` | ||
} | ||
: `<em>Hover your cursor over an element to inspect it's data.</em>` | ||
} | ||
<style> | ||
@@ -290,0 +316,0 @@ #_idb-collapse { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
59549
1344
+ Added@instantdb/core@0.7.6(transitive)
- Removed@instantdb/core@0.7.5(transitive)
Updated@instantdb/core@0.7.6