Open KristinaKoeva opened 7 years ago
Debugger Domain was implemented with these PRs https://github.com/NativeScript/ios-runtime/pull/693 https://github.com/NativeScript/nativescript-cli/pull/2248
Proof of concept to list CSS files in the resources pane:
__registerDomainDispatcher("CSS",
class CSSDomainDebugger {
enable() {
var bundlePath = NSBundle.mainBundle.bundlePath;
var cssFilePaths = NSBundle.pathsForResourcesOfTypeInDirectory("css", NSString.pathWithComponents([bundlePath, "app"])); // TODO: Search recursively
for (var cssFilePath of cssFilePaths) {
var relativePath = cssFilePath.substring(bundlePath.length);
__inspectorSendEvent(JSON.stringify({
"method": "CSS.styleSheetAdded",
"params": {
"header": {
"styleSheetId": relativePath,
"frameId": "NativeScriptMainFrameIdentifier",
"sourceURL": "file://" + relativePath,
"origin": "regular",
"title": "",
"disabled": false,
"isInline": false,
"startLine": 0,
"startColumn": 0
}
}
}));
}
}
getStyleSheetText(params) {
var styleSheetId = params.styleSheetId;
var absolutePath = NSString.pathWithComponents([NSBundle.mainBundle.bundlePath, styleSheetId]);
return { "text": NSString.stringWithContentsOfFileEncodingError(absolutePath, NSUTF8StringEncoding, null).toString() };
}
}
);
ping @pkoleva
Related issue https://github.com/NativeScript/ios-runtime/issues/788
Enable the following domains