[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/d92c5c72 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/tree/d92c5c72 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/diff/d92c5c72 Branch: refs/heads/master Commit: d92c5c7255cc73ee200efb9507fce75a9cbdffab Parents: 4e3c456 Author: shazron <shaz...@gmail.com> Authored: Tue Aug 7 18:03:55 2012 -0700 Committer: Anis Kadri <anis.ka...@gmail.com> Committed: Fri Aug 24 16:59:39 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/d92c5c72/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/d92c5c72/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 ------