{"action":"created","issue":{"url":"https://api.github.com/repos/SchizoDuckie/CreateReadUpdateDelete.js/issues/2","labels_url":"https://api.github.com/repos/SchizoDuckie/CreateReadUpdateDelete.js/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/SchizoDuckie/CreateReadUpdateDelete.js/issues/2/comments","events_url":"https://api.github.com/repos/SchizoDuckie/CreateReadUpdateDelete.js/issues/2/events","html_url":"https://github.com/SchizoDuckie/CreateReadUpdateDelete.js/issues/2","id":113231752,"number":2,"title":"ERROR TypeError: Cannot read property 'onConnect' of undefined","user":{"login":"MarioVanDenEijnde","id":12608918,"avatar_url":"https://avatars.githubusercontent.com/u/12608918?v=3","gravatar_id":"","url":"https://api.github.com/users/MarioVanDenEijnde","html_url":"https://github.com/MarioVanDenEijnde","followers_url":"https://api.github.com/users/MarioVanDenEijnde/followers","following_url":"https://api.github.com/users/MarioVanDenEijnde/following{/other_user}","gists_url":"https://api.github.com/users/MarioVanDenEijnde/gists{/gist_id}","starred_url":"https://api.github.com/users/MarioVanDenEijnde/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MarioVanDenEijnde/subscriptions","organizations_url":"https://api.github.com/users/MarioVanDenEijnde/orgs","repos_url":"https://api.github.com/users/MarioVanDenEijnde/repos","events_url":"https://api.github.com/users/MarioVanDenEijnde/events{/privacy}","received_events_url":"https://api.github.com/users/MarioVanDenEijnde/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":70,"created_at":"2015-10-25T15:16:56Z","updated_at":"2015-11-07T16:57:09Z","closed_at":null,"body":"Hello CRUD team,\r\n\r\nWhen calling the database with the basic code below I get this alert: ERROR TypeError: Cannot read property 'onConnect' of undefined\r\nEverthing else seems to work fine.\r\n```\r\nwindow.dbAdapter = new CRUD.SQLiteAdapter('mydatabase.sqlite');\r\n```\r\nPlease advise.\r\nKind regards,\r\nMario\r\n"},"comment":{"url":"https://api.github.com/repos/SchizoDuckie/CreateReadUpdateDelete.js/issues/comments/154723319","html_url":"https://github.com/SchizoDuckie/CreateReadUpdateDelete.js/issues/2#issuecomment-154723319","issue_url":"https://api.github.com/repos/SchizoDuckie/CreateReadUpdateDelete.js/issues/2","id":154723319,"user":{"login":"MarioVanDenEijnde","id":12608918,"avatar_url":"https://avatars.githubusercontent.com/u/12608918?v=3","gravatar_id":"","url":"https://api.github.com/users/MarioVanDenEijnde","html_url":"https://github.com/MarioVanDenEijnde","followers_url":"https://api.github.com/users/MarioVanDenEijnde/followers","following_url":"https://api.github.com/users/MarioVanDenEijnde/following{/other_user}","gists_url":"https://api.github.com/users/MarioVanDenEijnde/gists{/gist_id}","starred_url":"https://api.github.com/users/MarioVanDenEijnde/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MarioVanDenEijnde/subscriptions","organizations_url":"https://api.github.com/users/MarioVanDenEijnde/orgs","repos_url":"https://api.github.com/users/MarioVanDenEijnde/repos","events_url":"https://api.github.com/users/MarioVanDenEijnde/events{/privacy}","received_events_url":"https://api.github.com/users/MarioVanDenEijnde/received_events","type":"User","site_admin":false},"created_at":"2015-11-07T16:57:09Z","updated_at":"2015-11-07T16:57:09Z","body":"Hello SchizoDuckie,\r\n\r\nNeed some promise help:\r\nI found below code that returns the base64 which I can put in the database.\r\nBut I cannot get it right to return the image string before I put it into the database.\r\nBelow promise does not seem correct.\r\n\r\nCan you give me a hint?\r\n```\r\n// http://www.henryalgus.com/reading-binary-files-using-jquery-ajax/\r\nfunction fetchBlob(uri, callback) {\r\n  var xhr = new XMLHttpRequest();\r\n  xhr.open('GET', uri, true);\r\n  xhr.responseType = 'arraybuffer';\r\n\r\n  xhr.onload = function(e) {\r\n    if (this.status == 200) {\r\n      var blob = this.response;\r\n      if (callback) {\r\n        callback(blob);\r\n      }\r\n    }\r\n  };\r\n  xhr.send();\r\n};\r\n\r\nfetchBlob('https://i.imgur.com/uUGeiSFb.jpg', function(blob) {\r\n  var str = String.fromCharCode.apply(null, new Uint8Array(blob));\r\n  console.log(str);\r\nreturn str;\r\n  // the base64 data: image is then\r\n  // '<img src=\"data:image/jpeg;base64,' + btoa(str) + '\" />'\t\r\n}).then(function(result){\r\nputting the result in the database  but this seems not to be a correct promise.\r\n});\r\n```\r\nKind regards,\r\nMario"}}