bengillies / chrjs.store Goto Github PK
View Code? Open in Web Editor NEWA generic store object for use with the chrjs library
License: Other
A generic store object for use with the chrjs library
License: Other
Hi Ben,
I like this approach.
But wouldn't it be better to have a TiddlyWeb library, and on top of it, build a TiddlySpace specific AddOn, Plugin or such?
I think the other way around will be much more difficult.
-m
gets the error msg
"Object doesn't support this property or method"
It is possible to break the chrjs.store by adding something to localStorage that it doesn't expect.
For instance an external app might run the following javascript
localStorage.setItem("foo", "bar")
Expected:
Anything in a bad form should be ignored.
Actual:
Currently this can cause errors as "bar" might be attempted to be parsed as json.
I currently have a page for adding/editing tiddlers in the private bag on TiddlySpace and one for the public bag.
In the private page, I want to be able to see how many private tiddlers need syncing, and likewise in the public bag.
Currently creating a store and retrieving from cache and running dirty() gives me a list of all the dirty tiddlers.
Any ideas for how I could do this in a nice way?
Currently I must resort to getting tiddlers and looping through them checking their bags!
Sorry I couldn't get tests working in a dev copy of chrjs store, but essentially this test describes the problem where a put to "/bags/bag/tiddlers/bar dum" results in a success.
The last assertion fails.
test("chrjs-store", function() {
var tid = new tiddlyweb.Tiddler("bar dum", new tiddlyweb.Bag("bag", "/"));
var s = new tiddlyweb.Store();
strictEqual(s().dirty().length, 0, "have clean store");
s.add(tid);
strictEqual(s().dirty().length, 1, "have dirty store");
s.save(tid, function() {
}, function() {
});
strictEqual(s().dirty().length, 0, "successful save results in clean store");
});
Access to the xhrs would be useful for determining the difference between a timeout because I'm offline and a 404/501 etc error.
Currently the callback only provides the tiddler and an error message.
given a tiddler that has been retrieved via store.get
is there anyway to see if it came from the store?
store.get(note, function(tid) {
if(tid.fromCache()) {
// do something
}
});
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.