Comments (3)
Thanks for apprechiating the library.
By looking at the code, I see that you are sending 'db.bar.clear' as a pure function argument, which will invalidate the 'this' reference. There is not chance for the clear() method to know which Table instance to work with. A corrected version of your test would be:
var db = new Dexie('cleartest');
db.version(1).stores({
foo: '&id',
bar: '&id',
});
db.open();
db.foo.clear().then(function() {
return db.bar.clear();
}).then(function() {
alert("Successfully cleared foo and bar")
}).catch(alert);
Did I get it right?
from dexie.js.
oh silly error, this works too:
db.foo.clear().then(db.bar.clear.bind(db.bar))
although not sure which one is easier to read
from dexie.js.
True. Your works identically. It also returns the promise from db.bar.clear so that your chain of promises is intact and the final then() or catch() will in include its operation.
A question of taste which one is the simplest...
from dexie.js.
Related Issues (20)
- Cascade on delete HOT 6
- Undo stack HOT 5
- Detect when a database was added HOT 2
- Dynamically Upgraded Schema does not retain tables after page refresh HOT 3
- REST API endpoint /users changes do not get reflected to the client app HOT 6
- Port Dexie Cloud ToDo example app to Vite
- TypeError: Cannot set properties of undefined (setting 'onerror')
- dexie-cloud-addon: Support selecting demo user in db.cloud.userInteraction HOT 1
- Function name class when using Dexie and JSzip on same page due to setImmediate HOT 1
- liveQuery doesn't update for an orderBy on certain compound indexes (perhaps PK or autoincrement related?) HOT 1
- Object inserted without calling add/put HOT 1
- Compile error when calling modify on a table with generic types
- Question: Shared Database? HOT 2
- Document how to apply methods in separate statements HOT 4
- Feature Request: add direction to sortBy() method
- Moving from Dexie 3.2.5 to 4.0.1 creates webpack failure HOT 5
- orderBy silently creating a collection with unique keys HOT 2
- .anyOf query return is inconsistent but .bulkGet works HOT 1
- Simple Table.where not working as expected
- Unidentified issues / app hangs after upgrading Dexie to v4 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dexie.js.