对cordova-plugin-nativestorage
's demo example作了以下修改:
index.html
's patch [.pathKey]
index.js
's patch path
URLResourcesKey
是从加载页面后执行的脚本中调用的(由于32c32
< <!-- <meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *"> -->
---
> <meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *">
40c40
< <body onload="showData()">
---
> <body>
事件),但是为以下内容构建和运行:
未捕获的ReferenceError:未定义NativeStorage 在onData(index.html:40)的showData(index.js:81)处
我的问题是:从页面加载后执行的脚本中调用78,89c77
< app.initialize();
<
< function showData() {
< NativeStorage.getString("dummy_ref_obj",
< function (result) {
< alert("After the page has been loaded, the current stored value was: " + result);
< },
< function (e) {
< alert("For the moment, no data saved");
< });
< NativeStorage.clear();
< }
---
> app.initialize();
是否可以定义?
也许我的问题是因为I'm not waiting that the device is ready, before calling I'm calling the NativeStorage
plugin,但是在这种情况下,我看不到如何进行操作(我在Cordova中是个新手)。