You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sh...@apache.org on 2012/08/08 03:04:02 UTC
docs commit: [CB-1162] Add more detail to Entry.setMetadata for iOS
Updated Branches:
refs/heads/master 3ddece1a5 -> a41abaaad
[CB-1162] Add more detail to Entry.setMetadata for iOS
Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/commit/a41abaaa
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/tree/a41abaaa
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/diff/a41abaaa
Branch: refs/heads/master
Commit: a41abaaad1fd469abd9e7443b34f717db066e444
Parents: 3ddece1
Author: shazron <sh...@gmail.com>
Authored: Tue Aug 7 18:03:55 2012 -0700
Committer: shazron <sh...@gmail.com>
Committed: Tue Aug 7 18:03:55 2012 -0700
----------------------------------------------------------------------
.../cordova/file/directoryentry/directoryentry.md | 30 +++++++++++++++
docs/en/edge/cordova/file/fileentry/fileentry.md | 30 +++++++++++++++
2 files changed, 60 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/blob/a41abaaa/docs/en/edge/cordova/file/directoryentry/directoryentry.md
----------------------------------------------------------------------
diff --git a/docs/en/edge/cordova/file/directoryentry/directoryentry.md b/docs/en/edge/cordova/file/directoryentry/directoryentry.md
index 2c44d42..1726beb 100644
--- a/docs/en/edge/cordova/file/directoryentry/directoryentry.md
+++ b/docs/en/edge/cordova/file/directoryentry/directoryentry.md
@@ -113,6 +113,36 @@ __iOS Quirk__
- only the **"com.apple.MobileBackup"** extended attribute is supported. Set the value to **1** to NOT enable the directory to be backed up by iCloud. Set the value to **0** to re-enable the directory to be backed up by iCloud.
+__Quick Example__
+
+ function setFolderMetadata(localFileSystem, subFolder, metadataKey, metadataValue)
+ {
+ var onSetMetadataWin = function() {
+ console.log("success setting metadata")
+ }
+ var onSetMetadataFail = function() {
+ console.log("error setting metadata")
+ }
+
+ var onGetDirectoryWin = function(parent) {
+ parent.setMetadata(onSetMetadataWin, onSetMetadataFail, { metadataKey: metadataValue});
+ }
+ var onGetDirectoryFail = function() {
+ console.log("error getting dir")
+ }
+
+ var onFSWin = function(fileSystem) {
+ fileSystem.root.getDirectory(subFolder, {create: true, exclusive: false}, onGetDirectoryWin, onGetDirectoryFail);
+ }
+
+ var onFSFail = function(evt) {
+ console.log(evt.target.error.code);
+ }
+
+ window.requestFileSystem(localFileSystem, 0, onFSWin, onFSFail);
+ }
+
+ setFolderMetadata(LocalFileSystem.PERSISTENT, "Backups", "com.apple.MobileBackup", 1);
moveTo
------
http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/blob/a41abaaa/docs/en/edge/cordova/file/fileentry/fileentry.md
----------------------------------------------------------------------
diff --git a/docs/en/edge/cordova/file/fileentry/fileentry.md b/docs/en/edge/cordova/file/fileentry/fileentry.md
index 0fdfd1a..4137ba9 100644
--- a/docs/en/edge/cordova/file/fileentry/fileentry.md
+++ b/docs/en/edge/cordova/file/fileentry/fileentry.md
@@ -112,6 +112,36 @@ __iOS Quirk__
- only the **"com.apple.MobileBackup"** extended attribute is supported. Set the value to **1** to NOT enable the file to be backed up by iCloud. Set the value to **0** to re-enable the file to be backed up by iCloud.
+__Quick Example__
+
+ function setFileMetadata(localFileSystem, filePath, metadataKey, metadataValue)
+ {
+ var onSetMetadataWin = function() {
+ console.log("success setting metadata")
+ }
+ var onSetMetadataFail = function() {
+ console.log("error setting metadata")
+ }
+
+ var onGetFileWin = function(parent) {
+ parent.setMetadata(onSetMetadataWin, onSetMetadataFail, { metadataKey: metadataValue});
+ }
+ var onGetFileFail = function() {
+ console.log("error getting file")
+ }
+
+ var onFSWin = function(fileSystem) {
+ fileSystem.root.getFile(filePath, {create: true, exclusive: false}, onGetFileWin, onGetFileFail);
+ }
+
+ var onFSFail = function(evt) {
+ console.log(evt.target.error.code);
+ }
+
+ window.requestFileSystem(localFileSystem, 0, onFSWin, onFSFail);
+ }
+
+ setFileMetadata(LocalFileSystem.PERSISTENT, "Backups/sqlite.db", "com.apple.MobileBackup", 1);
moveTo
------