react-native-mock-tmp-build
Version:
A fully mocked and test-friendly version of react native
20 lines (17 loc) • 431 B
JavaScript
/**
* https://github.com/facebook/react-native/blob/master/React/Modules/RCTSourceCode.m
*/
let _sourceCode = null;
const SourceCode = {
getScriptText() {
return _sourceCode
? Promise.resolve(_sourceCode)
: Promise.reject(new Error('Source code is not available'));
},
__setScriptText(url, text) {
_sourceCode = !!url && !!text
? { url, text }
: null;
},
};
module.exports = SourceCode;