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

Function _handleLivesync

packages/core/ui/core/view/view-common.ts:260–292  ·  view source on GitHub ↗
(context?: ModuleContext)

Source from the content-addressed store, hash-verified

258 }
259
260 public _handleLivesync(context?: ModuleContext): boolean {
261 if (Trace.isEnabled()) {
262 Trace.write(`${this}._handleLivesync(${JSON.stringify(context)})`, Trace.categories.Livesync);
263 }
264
265 // Handle local CSS
266 if (viewMatchesModuleContext(this, context, ['style'])) {
267 if (Trace.isEnabled()) {
268 Trace.write(`Change Handled: Changing CSS for ${this}`, Trace.categories.Livesync);
269 }
270
271 // Always load styles with ".css" extension. Even when changes are in ".scss" ot ".less" files
272 const cssModuleName = `${sanitizeModuleName(context.path)}.css`;
273
274 this.changeCssFile(cssModuleName);
275
276 return true;
277 }
278
279 // Handle script/markup changes in custom components by falling back to page refresh
280 if (viewMatchesModuleContext(this, context, ['markup', 'script']) && this.page && this.page.frame) {
281 if (Trace.isEnabled()) {
282 Trace.write(`Change Handled: Changing ${context.type} for ${this} inside ${this.page}`, Trace.categories.Livesync);
283 }
284
285 return this.page.frame._handleLivesync({
286 type: context.type,
287 path: this.page._moduleName,
288 });
289 }
290
291 return false;
292 }
293
294 _setupAsRootView(context: any): void {
295 super._setupAsRootView(context);

Callers

nothing calls this directly

Calls 6

sanitizeModuleNameFunction · 0.90
viewMatchesModuleContextFunction · 0.85
isEnabledMethod · 0.80
changeCssFileMethod · 0.80
_handleLivesyncMethod · 0.80
writeMethod · 0.65

Tested by

no test coverage detected