Skip to content

Instantly share code, notes, and snippets.

@internetbird
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save internetbird/cba724fb0e85000ae4ec to your computer and use it in GitHub Desktop.
Save internetbird/cba724fb0e85000ae4ec to your computer and use it in GitHub Desktop.
//For simulating PhoneGup
M.PhoneGap = {};
//getImage
M.PhoneGap.getImage = function (callback) {
callback("someImage" + (new Date()).getMilliseconds() + ".jpg");
};
//mapFileName
M.PhoneGap.mapFileName = function (fileName, callback) {
var result = M.Guide.ServiceConfiguration.getServiceRepositoryFileUrl("Attachment", "Task", fileName);
callback(result);
};
//copyToDirectory
M.PhoneGap.copyToDirectory = function (uri, options) {
var fileEntry = {
toURL : function() {
return uri;
}
};
options.success(fileEntry);
};
M.PhoneGap.uploadFile = function () {
//Do nothing
};
M.PhoneGap.resolve = function (uri, callback) {
var fileEntry = {
file : function(next) {
var file = { size : 100 };
next(file);
}
};
callback(fileEntry);
};
M.PhoneGap.getRootDirectory = function () {
var rootDirectoy = { isDirectory: true, name: "rootDirectory" };
rootDirectoy.getDirectory = function (name, params, callback) {
var innerDirectory = { isDirectory: true, name: "innerDirectory" };
callback(innerDirectory);
};
rootDirectoy.toURL = function() {
return "rootDirectory";
};
return rootDirectoy;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment