mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
refactor: circular deps part 9
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
// Definitions.
|
||||
import { ImageSource as ImageSourceDefinition, iosSymbolScaleType } from '.';
|
||||
import { ImageAsset } from '../image-asset';
|
||||
import * as httpModule from '../http';
|
||||
import * as http from '../http';
|
||||
|
||||
// Types.
|
||||
import { path as fsPath, knownFolders } from '../file-system';
|
||||
@@ -14,13 +14,6 @@ import { getScaledDimensions } from './image-source-common';
|
||||
|
||||
export { isFileOrResourcePath };
|
||||
|
||||
let http: typeof httpModule;
|
||||
function ensureHttp() {
|
||||
if (!http) {
|
||||
http = require('../http');
|
||||
}
|
||||
}
|
||||
|
||||
let application: android.app.Application;
|
||||
let resources: android.content.res.Resources;
|
||||
|
||||
@@ -87,10 +80,8 @@ export class ImageSource implements ImageSourceDefinition {
|
||||
});
|
||||
}
|
||||
|
||||
static fromUrl(url: string): Promise<ImageSourceDefinition> {
|
||||
ensureHttp();
|
||||
|
||||
return http.getImage(url);
|
||||
static fromUrl(url: string): Promise<ImageSource> {
|
||||
return http.getImage(url) as Promise<ImageSource>;
|
||||
}
|
||||
|
||||
static fromResourceSync(name: string): ImageSource {
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
import { ImageSource as ImageSourceDefinition, iosSymbolScaleType } from '.';
|
||||
import { ImageAsset } from '../image-asset';
|
||||
import type { ImageBase } from '../ui/image/image-common';
|
||||
import * as httpModule from '../http';
|
||||
import { Font } from '../ui/styling/font';
|
||||
import { Color } from '../color';
|
||||
import { Trace } from '../trace';
|
||||
@@ -12,16 +11,10 @@ import { path as fsPath, knownFolders } from '../file-system';
|
||||
import { isFileOrResourcePath, RESOURCE_PREFIX, layout, releaseNativeObject, SYSTEM_PREFIX } from '../utils';
|
||||
|
||||
import { getScaledDimensions } from './image-source-common';
|
||||
import * as http from '../http';
|
||||
|
||||
export { isFileOrResourcePath };
|
||||
|
||||
let http: typeof httpModule;
|
||||
function ensureHttp() {
|
||||
if (!http) {
|
||||
http = require('../http');
|
||||
}
|
||||
}
|
||||
|
||||
export class ImageSource implements ImageSourceDefinition {
|
||||
public android: android.graphics.Bitmap;
|
||||
public ios: UIImage;
|
||||
@@ -69,9 +62,7 @@ export class ImageSource implements ImageSourceDefinition {
|
||||
}
|
||||
|
||||
static fromUrl(url: string): Promise<ImageSource> {
|
||||
ensureHttp();
|
||||
|
||||
return http.getImage(url);
|
||||
return http.getImage(url) as Promise<ImageSource>;
|
||||
}
|
||||
|
||||
static iosSystemScaleFor(scale: iosSymbolScaleType) {
|
||||
|
||||
Reference in New Issue
Block a user