Files
react-native/packager/react-packager/src/DependencyResolver/AssetModule_DEPRECATED.js
Amjad Masad bc28a35bda [react-packager] Use module objects across the codebase (rid of getPlainObject etc)
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.
2015-08-13 15:52:31 -08:00

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;