使用 Opera 小部件模拟器在 Opera 小部件中出现文件 I/O 问题
我正在为移动设备制作一个小部件,我想为我的小部件保存一些 xml 文件和图像文件,但是当我在用于 Windows 的 Opera 小部件移动模拟器中测试此代码时,我没有得到任何响应。
function storage () {
var mountpoint=opera.io.filesystem.mountSystemDirectory('storage','myCoolSaves');
alert('he he he '); //// It was just to check if it executes first line on not but it doesn't
var file = myCoolSaves.createDirectory('/myImages');
var stream = file.open('newfile.txt', opera.io.filemode.WRITE);
stream.writeLine('hello');
stream.close();
stream = file.open('newfile.txt');
var data = stream.readLine();
stream.close();
opera.postError(data);
}
但是,如果我将警报放在函数的开头,它会显示这意味着该函数正在被调用,但代码不起作用。我需要导入一些库吗?包括opera sdk??谁能帮帮我吗
I am making a widget for mobile and I want to save some xml files and image files for my widget but when I tested this code in opera widget Mobile emulator for windows, I didn't get any response.
function storage () {
var mountpoint=opera.io.filesystem.mountSystemDirectory('storage','myCoolSaves');
alert('he he he '); //// It was just to check if it executes first line on not but it doesn't
var file = myCoolSaves.createDirectory('/myImages');
var stream = file.open('newfile.txt', opera.io.filemode.WRITE);
stream.writeLine('hello');
stream.close();
stream = file.open('newfile.txt');
var data = stream.readLine();
stream.close();
opera.postError(data);
}
But if i put alert in start of the function it shows which means that the function's being called but the code is not working. Do I need to import some libraries?? include opera sdk?? can any one help me please
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Opera Mobile Widgets 不支持文件 I/O API(已在 上宣布) http://labs.opera.com/news/2008/05/08/)。文件 I/O 仅在桌面版本上受支持。
这解释了为什么您的代码无法在移动设备上运行。
Opera Mobile Widgets don't have support for the File I/O API (which was announced on http://labs.opera.com/news/2008/05/08/). File I/O is only supported on desktop builds.
This explains why your code isn't working on mobile.