|
1 | | -import { ImageAssetBase, getRequestedImageSize } from "./image-asset-common"; |
2 | | -import { path as fsPath, knownFolders } from "../file-system"; |
3 | | -import { queueGC } from "../utils"; |
| 1 | +import { ImageAssetBase, getRequestedImageSize } from './image-asset-common'; |
| 2 | +import { path as fsPath, knownFolders } from '../file-system'; |
| 3 | +import { queueGC } from '../utils'; |
4 | 4 |
|
5 | | -export * from "./image-asset-common"; |
| 5 | +export * from './image-asset-common'; |
6 | 6 |
|
7 | 7 | export class ImageAsset extends ImageAssetBase { |
8 | 8 | private _ios: PHAsset; |
9 | 9 |
|
10 | 10 | constructor(asset: string | PHAsset | UIImage) { |
11 | 11 | super(); |
12 | | - if (typeof asset === "string") { |
13 | | - if (asset.indexOf("~/") === 0) { |
14 | | - asset = fsPath.join(knownFolders.currentApp().path, asset.replace("~/", "")); |
| 12 | + if (typeof asset === 'string') { |
| 13 | + if (asset.indexOf('~/') === 0) { |
| 14 | + asset = fsPath.join(knownFolders.currentApp().path, asset.replace('~/', '')); |
15 | 15 | } |
16 | 16 |
|
17 | 17 | this.nativeImage = UIImage.imageWithContentsOfFile(asset); |
@@ -40,16 +40,16 @@ export class ImageAsset extends ImageAssetBase { |
40 | 40 | */ |
41 | 41 | public getImageAsync(callback: (image, error) => void, options?: { width?: number | string; height?: number | string }) { |
42 | 42 | if (options) { |
43 | | - if (typeof options.width === "string") { |
| 43 | + if (typeof options.width === 'string') { |
44 | 44 | options.width = parseInt(options.width, 10); |
45 | 45 | } |
46 | | - if (typeof options.height === "string") { |
| 46 | + if (typeof options.height === 'string') { |
47 | 47 | options.height = parseInt(options.height, 10); |
48 | 48 | } |
49 | 49 | } |
50 | 50 |
|
51 | 51 | if (!this.ios && !this.nativeImage) { |
52 | | - callback(null, "Asset cannot be found."); |
| 52 | + callback(null, 'Asset cannot be found.'); |
53 | 53 | } |
54 | 54 |
|
55 | 55 | const srcWidth = this.nativeImage ? this.nativeImage.size.width : this.ios.pixelWidth; |
|
0 commit comments