-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
48 lines (41 loc) · 1.3 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// var WavesKeeper=WavesKeeper||null;
angular.module('introApp', [])
.controller('ListController', function() {
var list = this;
list.todos = [
{text:'learn AngularJS', done:true},
{text:'build an AngularJS app', done:false}];
list.addTodo = function() {
list.todos.push({text:list.todoText, done:false});
list.todoText = '';
};
list.remaining = function() {
var count = 0;
angular.forEach(list.todos, function(todo) {
count += todo.done ? 0 : 1;
});
return count;
};
list.archive = function() {
var oldTodos = list.todos;
list.todos = [];
angular.forEach(oldTodos, function(todo) {
if (!todo.done) list.todos.push(todo);
});
};
list.authFunc = function () {
const authData = { data: "Auth on my site" };
if (WavesKeeper) {
WavesKeeper.auth( authData )
.then(auth => {
console.log( auth ); //displaying the result on the console
/*...processing data */
}).catch(error => {
console.error( error ); // displaying the result on the console
/*...processing errors */
})
} else {
alert("To Auth WavesKeeper should be installed.");
}
}
});