MCPcopy Index your code
hub / github.com/NativeScript/NativeScript / fromAsset

Method fromAsset

packages/core/image-source/index.ios.ts:48–58  ·  view source on GitHub ↗
(asset: ImageAsset)

Source from the content-addressed store, hash-verified

46 }
47
48 static fromAsset(asset: ImageAsset): Promise<ImageSource> {
49 return new Promise<ImageSource>((resolve, reject) => {
50 asset.getImageAsync((image, err) => {
51 if (image) {
52 resolve(new ImageSource(image));
53 } else {
54 reject(err);
55 }
56 });
57 });
58 }
59
60 static fromUrl(url: string): Promise<ImageSource> {
61 return httpRequest({ url, method: 'GET' }).then((response) => response.content.toNativeImage().then((value) => new ImageSource(value)));

Callers 11

constructorMethod · 0.95
fromAssetFunction · 0.45
pickImageMethod · 0.45
testFromAssetSimpleFunction · 0.45
imageSourceFromAssetFunction · 0.45

Calls 4

setNativeSourceMethod · 0.95
resolveFunction · 0.50
getImageAsyncMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected