{"action":"created","issue":{"url":"https://api.github.com/repos/Level/leveldown/issues/192","labels_url":"https://api.github.com/repos/Level/leveldown/issues/192/labels{/name}","comments_url":"https://api.github.com/repos/Level/leveldown/issues/192/comments","events_url":"https://api.github.com/repos/Level/leveldown/issues/192/events","html_url":"https://github.com/Level/leveldown/issues/192","id":89794938,"number":192,"title":"fallback to leveldown-mobile","user":{"login":"obastemur","id":4390745,"avatar_url":"https://avatars.githubusercontent.com/u/4390745?v=3","gravatar_id":"","url":"https://api.github.com/users/obastemur","html_url":"https://github.com/obastemur","followers_url":"https://api.github.com/users/obastemur/followers","following_url":"https://api.github.com/users/obastemur/following{/other_user}","gists_url":"https://api.github.com/users/obastemur/gists{/gist_id}","starred_url":"https://api.github.com/users/obastemur/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/obastemur/subscriptions","organizations_url":"https://api.github.com/users/obastemur/orgs","repos_url":"https://api.github.com/users/obastemur/repos","events_url":"https://api.github.com/users/obastemur/events{/privacy}","received_events_url":"https://api.github.com/users/obastemur/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-06-20T17:37:10Z","updated_at":"2015-06-28T22:29:00Z","closed_at":null,"body":"Below code is from `prebuilt.js`\r\n```\r\nvar binary = require('node-pre-gyp');\r\nvar path = require('path');\r\nvar binding_path = binary.find(path.resolve(path.join(__dirname,'./package.json')));\r\n\r\nmodule.exports = require(binding_path).leveldown;\r\n```\r\n\r\nOn iOS, dynamically linking is not allowed. On Android side, everything is inside the APK file. So, the application needs to extract .node file into real file system first and then link. Still this is not that practical for a node application. The developer needs to update node-modules per desktop and mobile separately.\r\n\r\nThe assumption for `leveldown-mobile` is that; the native part is already statically linked into framework. \r\n\r\nif we update prebuilt.js to below;\r\n```\r\ntry {\r\n  var binary = require('node-pre-gyp');\r\n  var path = require('path');\r\n  var binding_path = binary.find(path.resolve(path.join(__dirname,'./package.json')));\r\n \r\n  module.exports = require(binding_path).leveldown;\r\n} catch (e) {\r\n  if (typeof jxcore === 'undefined' || !process.versions.embedded || !process.versions.embedded.leveldown) \r\n    throw e;\r\n\r\n  module.exports = jxcore.embeddedModule.require('leveldown').leveldown;\r\n}\r\n```\r\n\r\nThis wouldn't make any change on actual Leveldown's behavior. However, it will be using embedded Leveldown automatically on mobile platforms.\r\n\r\nWhat do you think ?"},"comment":{"url":"https://api.github.com/repos/Level/leveldown/issues/comments/116356091","html_url":"https://github.com/Level/leveldown/issues/192#issuecomment-116356091","issue_url":"https://api.github.com/repos/Level/leveldown/issues/192","id":116356091,"user":{"login":"ralphtheninja","id":308049,"avatar_url":"https://avatars.githubusercontent.com/u/308049?v=3","gravatar_id":"","url":"https://api.github.com/users/ralphtheninja","html_url":"https://github.com/ralphtheninja","followers_url":"https://api.github.com/users/ralphtheninja/followers","following_url":"https://api.github.com/users/ralphtheninja/following{/other_user}","gists_url":"https://api.github.com/users/ralphtheninja/gists{/gist_id}","starred_url":"https://api.github.com/users/ralphtheninja/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ralphtheninja/subscriptions","organizations_url":"https://api.github.com/users/ralphtheninja/orgs","repos_url":"https://api.github.com/users/ralphtheninja/repos","events_url":"https://api.github.com/users/ralphtheninja/events{/privacy}","received_events_url":"https://api.github.com/users/ralphtheninja/received_events","type":"User","site_admin":false},"created_at":"2015-06-28T22:29:00Z","updated_at":"2015-06-28T22:29:00Z","body":"Hmm I kind of like the idea of some sort of fallback mechanism. What if I want to run application A that assumes leveldown somewhere underneath. It would be neat if there was some way of running any node application on jxcore *if* there are fallbacks defined somewhere."}}