Skip to content

Commit

Permalink
ONE BIG MASSIVE UPDATE
Browse files Browse the repository at this point in the history
  • Loading branch information
amark committed May 29, 2015
1 parent 2f59cb0 commit e89c19c
Show file tree
Hide file tree
Showing 26 changed files with 5,294 additions and 771 deletions.
1,259 changes: 1,259 additions & 0 deletions _gun.js

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions examples/angular/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,24 +53,24 @@ <h3>Admin JSON Editor</h3>
var gun = Gun(location.origin + '/gun');
angular.module('admin', []).controller('editor', function($scope){
$scope.data = {};
$scope.$data = gun.load('example/angular/data').blank(function(){
$scope.$data = gun.get('example/angular/data')/*.not(function(){
console.log("Initializing Data!");
this.set({});
}).on(function(data){
this.put({});
})*/.on(function(data){
Gun.obj.map(data, function(val, field){
if(val === $scope.data[field]){ return }
$scope.data[field] = val;
});
$scope.$apply();
});
$scope.add = function(){
$scope.$data.path($scope.field).set( $scope.data[$scope.field] = 'value' );
$scope.$data.path($scope.field).put( $scope.data[$scope.field] = 'value' );
$scope.field = '';
};
}).directive('gun', function(){
return function(scope, elem){
elem.on('keyup', function(){
scope.$data.path(scope.key).set( scope.data[scope.key] = elem.text() );
scope.$data.path(scope.key).put( scope.data[scope.key] = elem.text() );
});
};
});
Expand Down
4 changes: 2 additions & 2 deletions examples/hello-world.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ var gun = Gun({
bucket: '' // The bucket you want to save into
}
});
gun.set({ hello: 'world' }).key('my/first/data');
gun.put({ hello: 'world' }).key('my/first/data');

var http = require('http');
http.createServer(function(req, res){
gun.load('my/first/data', function(err, data){
gun.get('my/first/data', function(err, data){
res.writeHead(200, {'Content-Type': 'application/json'});
res.end(JSON.stringify(data));
});
Expand Down
2 changes: 1 addition & 1 deletion examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
}
, "dependencies": {
"express": "~>4.9.0",
"gun": "0.1.5"
"gun": "file:../"
}
, "scripts": {
"start": "node express.js",
Expand Down
9 changes: 5 additions & 4 deletions examples/todo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ <h2>ToDo List</h2>
<script>
// by Forrest Tait! Edited by Mark Nadal.
function ready(){
Gun.log.verbose = true;
var $ = document.querySelector.bind(document);
var gun = Gun(location.origin + '/gun').load('example/todo/data').set({});
var gun = Gun(location.origin + '/gun').get('example/todo/data');
gun.on(function renderToDo(val){
var todoHTML = '';
for(key in val) {
Expand All @@ -22,17 +23,17 @@ <h2>ToDo List</h2>
});
$("#addToDo").onsubmit = function(){
var id = randomId();
gun.path(id).set(($("#todoItem").value||'').toString().replace(/\</ig, '&lt;'));
gun.path(id).put(($("#todoItem").value||'').toString().replace(/\</ig, '&lt;'));
$("#todoItem").value = "";
return false;
};
window.removeToDo = function(id){
gun.path(id).set(null);
gun.path(id).put(null);
}
}
function randomId(){
return ''+(new Date()).getTime()+Math.round((Math.random()*1000));
}
</script>
</body>
</html>
</html>
Loading

0 comments on commit e89c19c

Please sign in to comment.