mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-01-19 00:12:53 +08:00
chore(tidy up): getting rid of redundant code to make TSDoc happy (#2747)
This commit is contained in:
parent
bdd1755f8b
commit
ac78a1540c
@ -1217,46 +1217,6 @@ export class File extends IonicNativePlugin {
|
||||
return this.readFile<ArrayBuffer>(path, file, 'ArrayBuffer');
|
||||
}
|
||||
|
||||
private readFile<T>(
|
||||
path: string,
|
||||
file: string,
|
||||
readAs: 'ArrayBuffer' | 'BinaryString' | 'DataURL' | 'Text'
|
||||
): Promise<T> {
|
||||
if (/^\//.test(file)) {
|
||||
const err = new FileError(5);
|
||||
err.message = 'file-name cannot start with /';
|
||||
return Promise.reject<any>(err);
|
||||
}
|
||||
|
||||
return this.resolveDirectoryUrl(path)
|
||||
.then((directoryEntry: DirectoryEntry) => {
|
||||
return this.getFile(directoryEntry, file, { create: false });
|
||||
})
|
||||
.then((fileEntry: FileEntry) => {
|
||||
const reader = new FileReader();
|
||||
return new Promise<T>((resolve, reject) => {
|
||||
reader.onloadend = () => {
|
||||
if (reader.result !== undefined || reader.result !== null) {
|
||||
resolve((reader.result as any) as T);
|
||||
} else if (reader.error !== undefined || reader.error !== null) {
|
||||
reject(reader.error);
|
||||
} else {
|
||||
reject({ code: null, message: 'READER_ONLOADEND_ERR' });
|
||||
}
|
||||
};
|
||||
|
||||
fileEntry.file(
|
||||
file => {
|
||||
reader[`readAs${readAs}`].call(reader, file);
|
||||
},
|
||||
error => {
|
||||
reject(error);
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Move a file to a given path.
|
||||
*
|
||||
|
@ -237,14 +237,6 @@ export class PayPalPayment {
|
||||
* Optional PayPalPaymentDetails object
|
||||
*/
|
||||
details: PayPalPaymentDetails;
|
||||
|
||||
constructor(amount: string, currency: string, shortDescription: string, intent: string, details?: PayPalPaymentDetails) {
|
||||
this.amount = amount;
|
||||
this.currency = currency;
|
||||
this.shortDescription = shortDescription;
|
||||
this.intent = intent;
|
||||
this.details = details;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -294,24 +286,6 @@ export class PayPalItem {
|
||||
* The stock keeping unit for this item. 50 characters max (optional)
|
||||
*/
|
||||
sku?: string;
|
||||
|
||||
/**
|
||||
* The PayPalItem class defines an optional itemization for a payment.
|
||||
* @see https://developer.paypal.com/docs/api/#item-object for more details.
|
||||
* @param {String} name: Name of the item. 127 characters max
|
||||
* @param {Number} quantity: Number of units. 10 characters max.
|
||||
* @param {String} price: Unit price for this item 10 characters max.
|
||||
* May be negative for "coupon" etc
|
||||
* @param {String} currency: ISO standard currency code.
|
||||
* @param {String} sku: The stock keeping unit for this item. 50 characters max (optional)
|
||||
*/
|
||||
constructor(name: string, quantity: number, price: string, currency: string, sku?: string) {
|
||||
this.name = name;
|
||||
this.quantity = quantity;
|
||||
this.price = price;
|
||||
this.currency = currency;
|
||||
this.sku = sku;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -546,24 +520,4 @@ export class PayPalShippingAddress {
|
||||
* 2-letter country code. 2 characters max.
|
||||
*/
|
||||
countryCode: string;
|
||||
|
||||
/**
|
||||
* See the documentation of the individual properties for more detail.
|
||||
* @param {String} recipientName: Name of the recipient at this address. 50 characters max.
|
||||
* @param {String} line1: Line 1 of the address (e.g., Number, street, etc). 100 characters max.
|
||||
* @param {String} line2: Line 2 of the address (e.g., Suite, apt #, etc). 100 characters max. Optional.
|
||||
* @param {String} city: City name. 50 characters max.
|
||||
* @param {String} state: 2-letter code for US states, and the equivalent for other countries. 100 characters max. Required in certain countries.
|
||||
* @param {String} postalCode: ZIP code or equivalent is usually required for countries that have them. 20 characters max. Required in certain countries.
|
||||
* @param {String} countryCode: 2-letter country code. 2 characters max.
|
||||
*/
|
||||
constructor(recipientName: string, line1: string, line2: string, city: string, state: string, postalCode: string, countryCode: string) {
|
||||
this.recipientName = recipientName;
|
||||
this.line1 = line1;
|
||||
this.line2 = line2;
|
||||
this.city = city;
|
||||
this.state = state;
|
||||
this.postalCode = postalCode;
|
||||
this.countryCode = countryCode;
|
||||
}
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ export class PhotoLibrary extends IonicNativePlugin {
|
||||
* @param options {GetLibraryOptions} Optional, like thumbnail size and chunks settings.
|
||||
* @return {Observable<LibraryItem[]>} Returns library items. If appropriate option was set, will be returned by chunks.
|
||||
*/
|
||||
@CordovaCheck({
|
||||
@Cordova({
|
||||
observable: true
|
||||
})
|
||||
getLibrary(options?: GetLibraryOptions): Observable<LibraryItem[]> {
|
||||
|
Loading…
Reference in New Issue
Block a user