Source code

Revision control

Copy as Markdown

Other Tools

/*
* Copyright 2010 The Closure Compiler Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @fileoverview Definitions for objects in the File API, File Writer API, and
* File System API. Details of the API are at:
*
* @externs
* @author dbk@google.com (David Barrett-Kahn)
*/
/**
* @param {Array.<ArrayBufferView|Blob|string>=} opt_blobParts
* @param {Object=} opt_options
* @constructor
* @nosideeffects
*/
function Blob(opt_blobParts, opt_options) {}
/**
* @type {number}
*/
Blob.prototype.size;
/**
* @type {string}
*/
Blob.prototype.type;
/**
* @param {number} start
* @param {number} length
* @return {!Blob}
* @nosideeffects
*/
Blob.prototype.slice = function(start, length) {};
/**
* This replaces Blob.slice in Chrome since WebKit revision 84005.
* @param {number} start
* @param {number} end
* @return {!Blob}
* @nosideeffects
*/
Blob.prototype.webkitSlice = function(start, end) {};
/**
* This replaces Blob.slice in Firefox.
* @param {number} start
* @param {number} end
* @return {!Blob}
* @nosideeffects
*/
Blob.prototype.mozSlice = function(start, end) {};
/**
* @constructor
*/
function BlobBuilder() {}
/**
* @param {string|Blob|ArrayBuffer} data
* @param {string=} endings
*/
BlobBuilder.prototype.append = function(data, endings) {};
/**
* @param {string=} contentType
* @return {!Blob}
*/
BlobBuilder.prototype.getBlob = function(contentType) {};
/**
* This has replaced BlobBuilder in Chrome since WebKit revision 84008.
* @constructor
*/
function WebKitBlobBuilder() {}
/**
* @param {string|Blob|ArrayBuffer} data
* @param {string=} endings
*/
WebKitBlobBuilder.prototype.append = function(data, endings) {};
/**
* @param {string=} contentType
* @return {!Blob}
*/
WebKitBlobBuilder.prototype.getBlob = function(contentType) {};
/**
* @constructor
* @extends {Entry}
*/
function DirectoryEntry() {};
/**
* @return {!DirectoryReader}
*/
DirectoryEntry.prototype.createReader = function() {};
/**
* @param {string} path
* @param {Object=} options
* @param {function(!FileEntry)=} successCallback
* @param {function(!FileError)=} errorCallback
*/
DirectoryEntry.prototype.getFile = function(path, options, successCallback,
errorCallback) {};
/**
* @param {string} path
* @param {Object=} options
* @param {function(!DirectoryEntry)=} successCallback
* @param {function(!FileError)=} errorCallback
*/
DirectoryEntry.prototype.getDirectory = function(path, options, successCallback,
errorCallback) {};
/**
* @param {function()} successCallback
* @param {function(!FileError)=} errorCallback
*/
DirectoryEntry.prototype.removeRecursively = function(successCallback,
errorCallback) {};
/**
* @constructor
*/
function DirectoryReader() {};
/**
* @param {function(!Array.<!Entry>)} successCallback
* @param {function(!FileError)=} errorCallback
*/
DirectoryReader.prototype.readEntries = function(successCallback,
errorCallback) {};
/**
* @constructor
*/
function Entry() {};
/**
* @type {boolean}
*/
Entry.prototype.isFile;
/**
* @type {boolean}
*/
Entry.prototype.isDirectory;
/**
* @type {string}
*/
Entry.prototype.name;
/**
* @type {string}
*/
Entry.prototype.fullPath;
/**
* @type {!FileSystem}
*/
Entry.prototype.filesystem;
/**
* @param {!DirectoryEntry} parent
* @param {string=} newName
* @param {function(!Entry)=} successCallback
* @param {function(!FileError)=} errorCallback
*/
Entry.prototype.moveTo = function(parent, newName, successCallback,
errorCallback) {};
/**
* @param {!DirectoryEntry} parent
* @param {string=} newName
* @param {function(!Entry)=} successCallback
* @param {function(!FileError)=} errorCallback
*/
Entry.prototype.copyTo = function(parent, newName, successCallback,
errorCallback) {};
/**
* @param {string=} mimeType
* @return {string}
*/
Entry.prototype.toURL = function(mimeType) {};
/**
* @param {function()} successCallback
* @param {function(!FileError)=} errorCallback
*/
Entry.prototype.remove = function(successCallback, errorCallback) {};
/**
* @param {function(!Metadata)} successCallback
* @param {function(!FileError)=} errorCallback
*/
Entry.prototype.getMetadata = function(successCallback, errorCallback) {};
/**
* @param {function(!Entry)} successCallback
* @param {function(!FileError)=} errorCallback
*/
Entry.prototype.getParent = function(successCallback, errorCallback) {};
/**
* @constructor
* @extends {Blob}
*/
function File() {}
/**
* Chrome uses this instead of name.
* @deprecated Use name instead.
* @type {string}
*/
File.prototype.fileName;
/**
* Chrome uses this instead of size.
* @deprecated Use size instead.
* @type {string}
*/
File.prototype.fileSize;
/**
* @type {string}
*/
File.prototype.name;
/**
* @type {Date}
*/
File.prototype.lastModifiedDate;
/**
* @constructor
* @extends {Entry}
*/
function FileEntry() {};
/**
* @param {function(!FileWriter)} successCallback
* @param {function(!FileError)=} errorCallback
*/
FileEntry.prototype.createWriter = function(successCallback, errorCallback) {};
/**
* @param {function(!File)} successCallback
* @param {function(!FileError)=} errorCallback
*/
FileEntry.prototype.file = function(successCallback, errorCallback) {};
/**
* @constructor
* @extends {DOMError}
*/
function FileError() {}
/**
* @type {number}
*/
FileError.prototype.NOT_FOUND_ERR = 1;
/** @type {number} */
FileError.NOT_FOUND_ERR = 1;
/**
* @type {number}
*/
FileError.prototype.SECURITY_ERR = 2;
/** @type {number} */
FileError.SECURITY_ERR = 2;
/**
* @type {number}
*/
FileError.prototype.ABORT_ERR = 3;
/** @type {number} */
FileError.ABORT_ERR = 3;
/**
* @type {number}
*/
FileError.prototype.NOT_READABLE_ERR = 4;
/** @type {number} */
FileError.NOT_READABLE_ERR = 4;
/**
* @type {number}
*/
FileError.prototype.ENCODING_ERR = 5;
/** @type {number} */
FileError.ENCODING_ERR = 5;
/**
* @type {number}
*/
FileError.prototype.NO_MODIFICATION_ALLOWED_ERR = 6;
/** @type {number} */
FileError.NO_MODIFICATION_ALLOWED_ERR = 6;
/**
* @type {number}
*/
FileError.prototype.INVALID_STATE_ERR = 7;
/** @type {number} */
FileError.INVALID_STATE_ERR = 7;
/**
* @type {number}
*/
FileError.prototype.SYNTAX_ERR = 8;
/** @type {number} */
FileError.SYNTAX_ERR = 8;
/**
* @type {number}
*/
FileError.prototype.INVALID_MODIFICATION_ERR = 9;
/** @type {number} */
FileError.INVALID_MODIFICATION_ERR = 9;
/**
* @type {number}
*/
FileError.prototype.QUOTA_EXCEEDED_ERR = 10;
/** @type {number} */
FileError.QUOTA_EXCEEDED_ERR = 10;
/**
* @type {number}
*/
FileError.prototype.TYPE_MISMATCH_ERR = 11;
/** @type {number} */
FileError.TYPE_MISMATCH_ERR = 11;
/**
* @type {number}
*/
FileError.prototype.PATH_EXISTS_ERR = 12;
/** @type {number} */
FileError.PATH_EXISTS_ERR = 12;
/**
* @type {number}
* @deprecated Use the 'name' or 'message' attributes of DOMError rather than
* 'code'
*/
FileError.prototype.code;
/**
* @constructor
* @implements {EventTarget}
*/
function FileReader() {}
/**
* @param {boolean=} opt_useCapture
* @override
*/
FileReader.prototype.addEventListener = function(type, listener, opt_useCapture)
{};
/**
* @param {boolean=} opt_useCapture
* @override
*/
FileReader.prototype.removeEventListener = function(type, listener,
opt_useCapture) {};
/** @override */
FileReader.prototype.dispatchEvent = function(evt) {};
/**
* @param {!Blob} blob
*/
FileReader.prototype.readAsArrayBuffer = function(blob) {};
/**
* @param {!Blob} blob
*/
FileReader.prototype.readAsBinaryString = function(blob) {};
/**
* @param {!Blob} blob
* @param {string=} encoding
*/
FileReader.prototype.readAsText = function(blob, encoding) {};
/**
* @param {!Blob} blob
*/
FileReader.prototype.readAsDataURL = function(blob) {};
/**
*/
FileReader.prototype.abort = function() {};
/**
* @type {number}
*/
FileReader.prototype.EMPTY = 0;
/**
* @type {number}
*/
FileReader.prototype.LOADING = 1;
/**
* @type {number}
*/
FileReader.prototype.DONE = 2;
/**
* @type {number}
*/
FileReader.prototype.readyState;
/**
* @type {string|Blob|ArrayBuffer}
*/
FileReader.prototype.result;
/**
* @type {FileError}
*/
FileReader.prototype.error;
/**
* @type {?function(!ProgressEvent)}
*/
FileReader.prototype.onloadstart;
/**
* @type {?function(!ProgressEvent)}
*/
FileReader.prototype.onprogress;
/**
* @type {?function(!ProgressEvent)}
*/
FileReader.prototype.onload;
/**
* @type {?function(!ProgressEvent)}
*/
FileReader.prototype.onabort;
/**
* @type {?function(!ProgressEvent)}
*/
FileReader.prototype.onerror;
/**
* @type {?function(!ProgressEvent)}
*/
FileReader.prototype.onloadend;
/**
* @constructor
*/
function FileSaver() {};
FileSaver.prototype.abort = function() {};
/**
* @type {number}
*/
FileSaver.prototype.INIT = 0;
/**
* @type {number}
*/
FileSaver.prototype.WRITING = 1;
/**
* @type {number}
*/
FileSaver.prototype.DONE = 2;
/**
* @type {number}
*/
FileSaver.prototype.readyState;
/**
* @type {FileError}
*/
FileSaver.prototype.error;
/**
* @type {?function(!ProgressEvent)}
*/
FileSaver.prototype.onwritestart;
/**
* @type {?function(!ProgressEvent)}
*/
FileSaver.prototype.onprogress;
/**
* @type {?function(!ProgressEvent)}
*/
FileSaver.prototype.onwrite;
/**
* @type {?function(!ProgressEvent)}
*/
FileSaver.prototype.onabort;
/**
* @type {?function(!ProgressEvent)}
*/
FileSaver.prototype.onerror;
/**
* @type {?function(!ProgressEvent)}
*/
FileSaver.prototype.onwriteend;
/**
* @constructor
*/
function FileSystem() {}
/**
* @type {string}
*/
FileSystem.prototype.name;
/**
* @type {!DirectoryEntry}
*/
FileSystem.prototype.root;
/**
* @constructor
* @extends {FileSaver}
*/
function FileWriter() {}
/**
* @type {number}
*/
FileWriter.prototype.position;
/**
* @type {number}
*/
FileWriter.prototype.length;
/**
* @param {!Blob} blob
*/
FileWriter.prototype.write = function(blob) {};
/**
* @param {number} offset
*/
FileWriter.prototype.seek = function(offset) {};
/**
* @param {number} size
*/
FileWriter.prototype.truncate = function(size) {};
/**
* LocalFileSystem interface, implemented by Window and WorkerGlobalScope.
* @constructor
*/
function LocalFileSystem() {}
/**
* Metadata interface.
* @constructor
*/
function Metadata() {}
/**
* @type {!Date}
*/
Metadata.prototype.modificationTime;
/**
* @type {number}
*/
Metadata.prototype.size;
/**
* @type {number}
*/
Window.prototype.TEMPORARY = 0;
/**
* @type {number}
*/
Window.prototype.PERSISTENT = 1;
/**
* @param {number} type
* @param {number} size
* @param {function(!FileSystem)} successCallback
* @param {function(!FileError)=} errorCallback
*/
function requestFileSystem(type, size, successCallback, errorCallback) {}
/**
* @param {number} type
* @param {number} size
* @param {function(!FileSystem)} successCallback
* @param {function(!FileError)=} errorCallback
*/
Window.prototype.requestFileSystem = function(type, size, successCallback,
errorCallback) {};
/**
* @param {string} uri
* @param {function(!Entry)} successCallback
* @param {function(!FileError)=} errorCallback
*/
function resolveLocalFileSystemURI(uri, successCallback, errorCallback) {}
/**
* @param {string} uri
* @param {function(!Entry)} successCallback
* @param {function(!FileError)=} errorCallback
*/
Window.prototype.resolveLocalFileSystemURI = function(uri, successCallback,
errorCallback) {}
/**
* This has replaced requestFileSystem in Chrome since WebKit revision 84224.
* @param {number} type
* @param {number} size
* @param {function(!FileSystem)} successCallback
* @param {function(!FileError)=} errorCallback
*/
function webkitRequestFileSystem(type, size, successCallback, errorCallback) {}
/**
* This has replaced requestFileSystem in Chrome since WebKit revision 84224.
* @param {number} type
* @param {number} size
* @param {function(!FileSystem)} successCallback
* @param {function(!FileError)=} errorCallback
*/
Window.prototype.webkitRequestFileSystem = function(type, size, successCallback,
errorCallback) {};
/**
* This has replaced resolveLocalFileSystemURI in Chrome since WebKit revision
* 84224.
* @param {string} uri
* @param {function(!Entry)} successCallback
* @param {function(!FileError)=} errorCallback
*/
function webkitResolveLocalFileSystemURI(uri, successCallback, errorCallback) {}
/**
* This has replaced resolveLocalFileSystemURI in Chrome since WebKit revision
* 84224.
* @param {string} uri
* @param {function(!Entry)} successCallback
* @param {function(!FileError)=} errorCallback
*/
Window.prototype.webkitResolveLocalFileSystemURI = function(uri, successCallback,
errorCallback) {}
// WindowBlobURIMethods interface, implemented by Window and WorkerGlobalScope.
// There are three APIs for this: the old specced API, the new specced API, and
// the webkit-prefixed API.
/**
* @param {!Object} obj
* @return {string}
*/
function createObjectURL(obj) {};
/**
* @param {!Object} obj
* @return {string}
*/
Window.prototype.createObjectURL = function(obj) {};
/**
* @param {string} url
*/
function revokeObjectURL(url) {};
/**
* @param {string} url
*/
Window.prototype.revokeObjectURL = function(url) {};
/**
* @constructor
*/
function DOMURL() {}
/**
* @constructor
* @param {string} urlString
* @param {string=} opt_base
* @extends {DOMURL}
*/
function URL(urlString, opt_base) {}
/** @type {string} */
URL.prototype.protocol;
/**
* @param {!File|!Blob|!MediaSource|!MediaStream} obj
* @return {string}
*/
URL.createObjectURL = function(obj) {};
/**
* @param {string} url
*/
URL.revokeObjectURL = function(url) {};
/**
* This has been replaced by URL in Chrome since WebKit revision 75739.
* @constructor
* @param {string} urlString
* @param {string=} opt_base
* @extends {DOMURL}
*/
function webkitURL(urlString, opt_base) {}
/** @constructor */
window.webkitURL = webkitURL;
/**
* @param {!Object} obj
* @return {string}
*/
webkitURL.createObjectURL = function(obj) {};
/**
* @param {string} url
*/
webkitURL.revokeObjectURL = function(url) {};
/**
* @constructor
*/
function StorageInfo() {}
/**
* @type {number}
* */
StorageInfo.prototype.TEMPORARY = 0;
/**
* @type {number}
*/
StorageInfo.prototype.PERSISTENT = 1;
/**
* @param {number} type
* @param {number} size
* @param {function(number)} successCallback
* @param {function(!DOMException)=} errorCallback
*/
StorageInfo.prototype.requestQuota = function(type, size, successCallback,
errorCallback) {};
/**
* @param {number} type
* @param {function(number, number)} successCallback
* @param {function(!DOMException)=} errorCallback
*/
StorageInfo.prototype.queryUsageAndQuota = function(type, successCallback,
errorCallback) {};
/**
* @type {!StorageInfo}
*/
Window.prototype.webkitStorageInfo;
/**
* @constructor
*/
function StorageQuota() {}
/**
* @param {number} size
* @param {function(number)=} opt_successCallback
* @param {function(!DOMException)=} opt_errorCallback
*/
StorageQuota.prototype.requestQuota = function(size, opt_successCallback,
opt_errorCallback) {};
/**
* @param {function(number, number)} successCallback
* @param {function(!DOMException)=} opt_errorCallback
*/
StorageQuota.prototype.queryUsageAndQuota = function(successCallback,
opt_errorCallback) {};