mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-02-11 17:21:11 +08:00
Summary: Instead of using plain objects and having to convert to and from them we just use the `Module` class across the codebase. This seems cleaner and can enforce the type as opposed to fuzzy objects.
50 lines
891 B
JavaScript
50 lines
891 B
JavaScript
'use strict';
|
|
|
|
const Module = require('./Module');
|
|
const Promise = require('promise');
|
|
const getAssetDataFromName = require('../lib/getAssetDataFromName');
|
|
|
|
class AssetModule_DEPRECATED extends Module {
|
|
constructor(...args) {
|
|
super(...args);
|
|
const {resolution, name} = getAssetDataFromName(this.path);
|
|
this.resolution = resolution;
|
|
this.name = name;
|
|
}
|
|
|
|
isHaste() {
|
|
return Promise.resolve(false);
|
|
}
|
|
|
|
getName() {
|
|
return Promise.resolve(`image!${this.name}`);
|
|
}
|
|
|
|
getDependencies() {
|
|
return Promise.resolve([]);
|
|
}
|
|
|
|
getAsyncDependencies() {
|
|
return Promise.resolve([]);
|
|
}
|
|
|
|
hash() {
|
|
return `AssetModule_DEPRECATED : ${this.path}`;
|
|
}
|
|
|
|
isJSON() {
|
|
return false;
|
|
}
|
|
|
|
isAsset_DEPRECATED() {
|
|
return true;
|
|
}
|
|
|
|
resolution() {
|
|
return getAssetDataFromName(this.path).resolution;
|
|
}
|
|
|
|
}
|
|
|
|
module.exports = AssetModule_DEPRECATED;
|