mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Imporvements and lint fix
This commit is contained in:
committed by
Vladimir Enchev
parent
ae8b285fc0
commit
047893a18b
2
ui/enums/enums.d.ts
vendored
2
ui/enums/enums.d.ts
vendored
@@ -311,8 +311,6 @@
|
||||
export var allCharacters: string;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Defines the recognized image formats.
|
||||
*/
|
||||
|
||||
@@ -86,7 +86,6 @@ export module AutocapitalizationType {
|
||||
export var allCharacters: string = "allCharacters";
|
||||
}
|
||||
|
||||
|
||||
export module ImageFormat {
|
||||
export var png: string = "png";
|
||||
export var jpeg: string = "jpeg";
|
||||
|
||||
@@ -15,10 +15,6 @@ var IMAGE = "Image";
|
||||
var ISLOADING = "isLoading";
|
||||
var STRETCH = "stretch";
|
||||
|
||||
function isUrl(value: string): boolean {
|
||||
return value.indexOf("http://") === 0 || value.indexOf("https://") === 0;
|
||||
}
|
||||
|
||||
function isValidSrc(src: any): boolean {
|
||||
return types.isString(src);
|
||||
}
|
||||
@@ -34,16 +30,16 @@ function onSrcPropertyChanged(data: dependencyObservable.PropertyChangeData) {
|
||||
|
||||
image._setValue(Image.isLoadingProperty, true);
|
||||
|
||||
if (isUrl(value)) {
|
||||
if (imageSource.isFileOrResourcePath(value)) {
|
||||
image.imageSource = imageSource.fromFileOrResource(value);
|
||||
image._setValue(Image.isLoadingProperty, false);
|
||||
} else {
|
||||
imageSource.fromUrl(value).then((r) => {
|
||||
if (image["_url"] === value) {
|
||||
image.imageSource = r;
|
||||
image._setValue(Image.isLoadingProperty, false);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
image.imageSource = imageSource.fromFileOrResource(value);
|
||||
image._setValue(Image.isLoadingProperty, false);
|
||||
}
|
||||
}
|
||||
else if (value instanceof imageSource.ImageSource) {
|
||||
|
||||
Reference in New Issue
Block a user