-
-
Notifications
You must be signed in to change notification settings - Fork 626
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
table clear #60
Comments
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? |
oh silly error, this works too: although not sure which one is easier to read |
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... |
Hi, first got to say its a pleasure to work with yours library.
I think there is a issue with clear method it returns error when used with bind method, example:
var db = new Dexie('cleartest');
db.version(1).stores({
foo: '&id',
bar: '&id',
});
db.open();
db.foo.clear().then(db.bar.clear).catch(alert);
it errors with:
"TypeError: undefined is not an object (evaluating 'this.hook')"
The text was updated successfully, but these errors were encountered: