This commit is contained in:
Mark Nadal 2015-07-20 17:57:27 -07:00
commit 2ddb9d7ec4
5 changed files with 35 additions and 13 deletions

View File

@ -33,7 +33,7 @@ var gun = Gun({
});
```
These are the default persistence layers, they are modular and can be replaced others.
These are the default persistence layers, they are modular and can be replaced by others.
Using S3 is recommended for deployment, and using a file is recommended for local development.
@ -58,7 +58,7 @@ Version 0.2.0 is currently in alpha. Important changes include `.get` to `.val`
GUN is not stable, and therefore should not be trusted in a production environment.
***
## API
## [API](https://github.com/amark/gun/wiki/JS-API)
Below is a really basic overview of how the gun API works. For a more detailed explanation with many more examples, [check out the wiki](https://github.com/amark/gun/wiki).

View File

@ -8,7 +8,7 @@
}
, "dependencies": {
"express": "~>4.9.0",
"gun": "~>0.2.0-alpha-2"
"gun": "~>0.2.0-alpha-4"
}
, "scripts": {
"start": "node http.js",

View File

@ -1,6 +1,6 @@
{
"name": "gun",
"version": "0.2.0-alpha-3",
"version": "0.2.0-alpha-4",
"description": "Graph engine",
"main": "index.js",
"scripts": {

View File

@ -1837,6 +1837,28 @@ describe('Gun', function(){
})
});
it("ToDo", function(done){ // Simulate ToDo app!
var gun = Gun().get('example/todo/data');
gun.on(function renderToDo(val){
if(done.done){ return }
if(done.clear){
done.done = true;
expect(val[done.id]).to.not.be.ok();
return done();
}
delete val._;
Gun.obj.map(val, function(val, field){ return done.id = field; });
expect(val[done.id]).to.be('groceries');
});
setTimeout(function(){ // form submit
gun.set("groceries");
setTimeout(function(){ // clear off element
done.clear = true;
gun.path(done.id).put(null);
},100);
},200);
});
it("gun put null path on put sub object", function(done){ // consensus4's bug
done.c = 1;
var gun = Gun();

View File

@ -73,7 +73,7 @@ var code = $('.edit').load('./editor.html', function(){setTimeout(function(){
<p>Insert the following between the ending <u>ul</u> tag and the ending <u>body</u> tag, replacing the comment line:</p>
<textarea style="height: 6em;">
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="https://rawgit.com/amark/gun/develop/gun.js"></script>
<script src="https://rawgit.com/amark/gun/master/gun.js"></script>
<script>
alert("Good job! You'll replace this line in the next step!");
</script></textarea>
@ -97,7 +97,7 @@ var code = $('.edit').load('./editor.html', function(){setTimeout(function(){
<ul></ul>
</script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
</script src="https://rawgit.com/amark/gun/develop/gun.js"></script>
</script src="https://rawgit.com/amark/gun/master/gun.js"></script>
</script>
alert("Good job! You'll replace this line in the next step!");
</script>
@ -137,7 +137,7 @@ var code = $('.edit').load('./editor.html', function(){setTimeout(function(){
<ul></ul>
</script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
</script src="https://rawgit.com/amark/gun/develop/gun.js"></script>
</script src="https://rawgit.com/amark/gun/master/gun.js"></script>
</script>
$('form').on('submit', function(event){
event.preventDefault();
@ -169,7 +169,7 @@ var code = $('.edit').load('./editor.html', function(){setTimeout(function(){
<ul></ul>
</script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
</script src="https://rawgit.com/amark/gun/develop/gun.js"></script>
</script src="https://rawgit.com/amark/gun/master/gun.js"></script>
</script>
var gun = Gun().get('thoughts').set();
$('form').on('submit', function(event){
@ -201,7 +201,7 @@ var code = $('.edit').load('./editor.html', function(){setTimeout(function(){
<ul></ul>
</script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
</script src="https://rawgit.com/amark/gun/develop/gun.js"></script>
</script src="https://rawgit.com/amark/gun/master/gun.js"></script>
</script>
var gun = Gun().get('thoughts').set();
$('form').on('submit', function(event){
@ -249,7 +249,7 @@ var code = $('.edit').load('./editor.html', function(){setTimeout(function(){
<ul></ul>
</script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
</script src="https://rawgit.com/amark/gun/develop/gun.js"></script>
</script src="https://rawgit.com/amark/gun/master/gun.js"></script>
</script>
var gun = Gun().get('thoughts').set();
$('form').on('submit', function(event){
@ -295,7 +295,7 @@ var code = $('.edit').load('./editor.html', function(){setTimeout(function(){
<ul></ul>
</script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
</script src="https://rawgit.com/amark/gun/develop/gun.js"></script>
</script src="https://rawgit.com/amark/gun/master/gun.js"></script>
</script>
var gun = Gun().get('thoughts').set();
$('form').on('submit', function(event){
@ -358,7 +358,7 @@ next.step = [null, null, function(){
code.contents().filter(function(){ return this.nodeType == 8 }).remove();
var ul = code.find('ul');
if(ctx.alert){ ul.after($('<script>').text('\n\t\t\talert("Good job! Our code will go in this script tag!");\n\t\t')) }
if(ctx.gun){ ul.after($('<script>').attr('src', 'https://rawgit.com/amark/gun/develop/gun.js')) }
if(ctx.gun){ ul.after($('<script>').attr('src', 'https://rawgit.com/amark/gun/master/gun.js')) }
if(ctx.$){ ul.after($('<script>').attr('src','https://code.jquery.com/jquery-1.11.3.min.js')) }
if(ctx.alert || ctx.gun || ctx.$){ next.mir.setValue(next.wrap($.trim(code.html().replace(/<script/ig, '\n\t\t<script')))) }
}, function(){
@ -403,4 +403,4 @@ next.step = [null, null, function(){
}]
</script>
</body>
</html>
</html>