Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CreateNote() gets called....
- //------------------------------------------
- class NoteController {
- constructor() {
- this.store = new NoteStore();
- }
- CreateNote() {
- var title = $("#edtNoteTitle").val();
- if (title.length < 1) {
- this.CreateToast(false);
- return;
- } else if ($.inArray(title, this.store.notes.map(n => n.title)) >= 0) {
- this.CreateToast(false);
- return;
- }
- this.store.AddNote(new Note(title, $("#edtNoteText").val()), this.store);
- this.CreateToast(true);
- }
- CreateToast(isValid) {
- }
- }
- //------------------------------------------
- class NoteStore {
- constructor() {
- this.notes = [];
- }
- AddNote(note) {
- this.notes.push(note);
- }
- }
- //------------------------------------------
- class Note {
- constructor(noteTitle, noteText, noteStore) {
- this.title = noteTitle;
- this.text = noteText;
- this.store = noteStore;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement