Skip to content

Commit

Permalink
adding createSnapshot method
Browse files Browse the repository at this point in the history
  • Loading branch information
Hakan Bilgin committed Nov 17, 2018
1 parent 03a4df3 commit ca40a48
Show file tree
Hide file tree
Showing 11 changed files with 1,870 additions and 2,602 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/node_modules

/npm-debug.log
/npm-debug.log

yarn.lock
package-lock.json
4 changes: 2 additions & 2 deletions demo/test2.htm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>Defiant.js</title>
<script type="text/javascript" src="/defiant.js/dist/defiant.min.js"></script>
<script type="text/javascript" src="/defiant.js/dist/defiant.js"></script>
</head>
<body>

Expand All @@ -15,7 +15,7 @@
Defiant.getSnapshot(data, function(snapshot) {

// searching on snapshot created with web worker
var found = JSON.search(snapshot, '//prices');
var found = JSON.search(snapshot, '//price');

// found
console.log( found );
Expand Down
31 changes: 31 additions & 0 deletions demo/test3.htm
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>Defiant.js - create snapshot</title>
<script type="text/javascript" src="/defiant.js/dist/defiant.js"></script>
</head>
<body>

<script type="text/javascript">

var test = {
init: function(data) {
// get the snapshot with a callback function
Defiant.createSnapshot(data, function(snapshotId) {
console.log(snapshotId);
// searching on snapshot created with web worker
var found = JSON.search(snapshotId, '//price');

// found
console.log( found );
});
}
};

</script>
<!-- Load JSON structure -->
<script type="text/javascript" src="/defiant.js/demo/tmp2.js"></script>

</body>
</html>
Loading

0 comments on commit ca40a48

Please sign in to comment.