-
Notifications
You must be signed in to change notification settings - Fork 0
/
notes_ui_manager_init.js
29 lines (26 loc) · 1.01 KB
/
notes_ui_manager_init.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
define(
['app/add_note_ui', 'app/generate_notes_view_init'],
function (add_note_ui, generate_notes_view_init) {
"use strict";
return function (notes_storage_mgr) {
var ui_handlers = {
note_add_input: add_note_ui,
notes_view: generate_notes_view_init(notes_storage_mgr),
new_note: function (note_obj) {
var index = notes_storage_mgr.add_note(note_obj);
this.notes_view.append_note_to_list(note_obj, index);
}
};
// Debug function to add a set amount of notes
NOTESDEMO.dbg_add_notes = function (n) {
for (var i = 1; i <= n; i++) {
ui_handlers.new_note({
title: ('generated note ' + i),
body: ('I can do it! I can do it ' + i + ' times!')
});
}
};
return ui_handlers;
};
}
);