{"action":"created","issue":{"url":"https://api.github.com/repos/sunnylqm/react-native-storage/issues/85","repository_url":"https://api.github.com/repos/sunnylqm/react-native-storage","labels_url":"https://api.github.com/repos/sunnylqm/react-native-storage/issues/85/labels{/name}","comments_url":"https://api.github.com/repos/sunnylqm/react-native-storage/issues/85/comments","events_url":"https://api.github.com/repos/sunnylqm/react-native-storage/issues/85/events","html_url":"https://github.com/sunnylqm/react-native-storage/issues/85","id":222942403,"number":85,"title":"写了一个Storage.JS","user":{"login":"Rcrosp","id":8972396,"avatar_url":"https://avatars2.githubusercontent.com/u/8972396?v=3","gravatar_id":"","url":"https://api.github.com/users/Rcrosp","html_url":"https://github.com/Rcrosp","followers_url":"https://api.github.com/users/Rcrosp/followers","following_url":"https://api.github.com/users/Rcrosp/following{/other_user}","gists_url":"https://api.github.com/users/Rcrosp/gists{/gist_id}","starred_url":"https://api.github.com/users/Rcrosp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Rcrosp/subscriptions","organizations_url":"https://api.github.com/users/Rcrosp/orgs","repos_url":"https://api.github.com/users/Rcrosp/repos","events_url":"https://api.github.com/users/Rcrosp/events{/privacy}","received_events_url":"https://api.github.com/users/Rcrosp/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-04-20T03:57:20Z","updated_at":"2017-04-20T03:58:27Z","closed_at":null,"body":"```\r\nimport { AsyncStorage } from 'react-native';\r\nimport Storage from 'react-native-storage';\r\n\r\nvar storage = new Storage({\r\n    // 最大容量，默认值1000条数据循环存储\r\n    size: 1000,\r\n\r\n    // 存储引擎：对于RN使用AsyncStorage，对于web使用window.localStorage\r\n    // 如果不指定则数据只会保存在内存中，重启后即丢失\r\n    storageBackend: AsyncStorage,\r\n\r\n    // 数据过期时间，默认一整天（1000 * 3600 * 24 毫秒），设为null则永不过期\r\n    defaultExpires: 1000 * 3600 * 24,\r\n\r\n    // 读写时在内存中缓存数据。默认启用。\r\n    enableCache: true,\r\n\r\n    // 如果storage中没有相应数据，或数据已过期，\r\n    // 则会调用相应的sync方法，无缝返回最新数据。\r\n    // sync方法的具体说明会在后文提到\r\n    // 你可以在构造函数这里就写好sync的方法\r\n    // 或是写到另一个文件里，这里require引入\r\n    // 或是在任何时候，直接对storage.sync进行赋值修改\r\n    sync: require('./sync')\r\n})\r\n\r\nglobal.storage = storage;\r\n```\r\n\r\n\r\n在别的地方引用，出现ReferenceError: storage is not defined，在入口引用该JS直接报错，请问是什么原因"},"comment":{"url":"https://api.github.com/repos/sunnylqm/react-native-storage/issues/comments/295571409","html_url":"https://github.com/sunnylqm/react-native-storage/issues/85#issuecomment-295571409","issue_url":"https://api.github.com/repos/sunnylqm/react-native-storage/issues/85","id":295571409,"user":{"login":"Rcrosp","id":8972396,"avatar_url":"https://avatars2.githubusercontent.com/u/8972396?v=3","gravatar_id":"","url":"https://api.github.com/users/Rcrosp","html_url":"https://github.com/Rcrosp","followers_url":"https://api.github.com/users/Rcrosp/followers","following_url":"https://api.github.com/users/Rcrosp/following{/other_user}","gists_url":"https://api.github.com/users/Rcrosp/gists{/gist_id}","starred_url":"https://api.github.com/users/Rcrosp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Rcrosp/subscriptions","organizations_url":"https://api.github.com/users/Rcrosp/orgs","repos_url":"https://api.github.com/users/Rcrosp/repos","events_url":"https://api.github.com/users/Rcrosp/events{/privacy}","received_events_url":"https://api.github.com/users/Rcrosp/received_events","type":"User","site_admin":false},"created_at":"2017-04-20T03:58:27Z","updated_at":"2017-04-20T03:58:27Z","body":"GET http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false 500 (Internal Server Error)"}}
{"actor":{"display_login":"Rcrosp"}}