mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 12:57:42 +08:00
Add a flag we can use to skip string template calcs in release
This commit is contained in:
@ -86,7 +86,9 @@ export class CssSelector {
|
||||
try {
|
||||
view.style._setValue(resolvedProperty, value, modifier);
|
||||
} catch (ex) {
|
||||
trace.write("Error setting property: " + resolvedProperty.name + " view: " + view + " value: " + value + " " + ex, trace.categories.Style, trace.messageType.error);
|
||||
if (trace.enabled) {
|
||||
trace.write("Error setting property: " + resolvedProperty.name + " view: " + view + " value: " + value + " " + ex, trace.categories.Style, trace.messageType.error);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -106,7 +106,9 @@ function loadFontFromFile(fontFamily: string): android.graphics.Typeface {
|
||||
fontAssetPath = FONTS_BASE_PATH + fontFamily + ".otf";
|
||||
}
|
||||
else {
|
||||
trace.write("Could not find font file for " + fontFamily, trace.categories.Error, trace.messageType.error);
|
||||
if (trace.enabled) {
|
||||
trace.write("Could not find font file for " + fontFamily, trace.categories.Error, trace.messageType.error);
|
||||
}
|
||||
}
|
||||
|
||||
if (fontAssetPath) {
|
||||
@ -114,7 +116,9 @@ function loadFontFromFile(fontFamily: string): android.graphics.Typeface {
|
||||
fontAssetPath = fs.path.join(fs.knownFolders.currentApp().path, fontAssetPath);
|
||||
result = android.graphics.Typeface.createFromFile(fontAssetPath)
|
||||
} catch (e) {
|
||||
trace.write("Error loading font asset: " + fontAssetPath, trace.categories.Error, trace.messageType.error);
|
||||
if (trace.enabled) {
|
||||
trace.write("Error loading font asset: " + fontAssetPath, trace.categories.Error, trace.messageType.error);
|
||||
}
|
||||
}
|
||||
}
|
||||
typefaceCache.set(fontFamily, result);
|
||||
|
@ -306,7 +306,9 @@ export module ios {
|
||||
if (!CTFontManagerRegisterGraphicsFont(font, error)) {
|
||||
var trace: typeof traceModule = require("trace");
|
||||
|
||||
trace.write("Error occur while registering font: " + CFErrorCopyDescription(<NSError>error.value), trace.categories.Error, trace.messageType.error);
|
||||
if (trace.enabled) {
|
||||
trace.write("Error occur while registering font: " + CFErrorCopyDescription(<NSError>error.value), trace.categories.Error, trace.messageType.error);
|
||||
}
|
||||
}
|
||||
|
||||
areSystemFontSetsValid = false;
|
||||
|
@ -864,11 +864,13 @@ export class Style extends DependencyObservable implements styling.Style {
|
||||
}
|
||||
|
||||
public _onPropertyChanged(property: Property, oldValue: any, newValue: any) {
|
||||
trace.write(
|
||||
"Style._onPropertyChanged view:" + this._view +
|
||||
", property: " + property.name +
|
||||
", oldValue: " + oldValue +
|
||||
", newValue: " + newValue, trace.categories.Style);
|
||||
if (trace.enabled) {
|
||||
trace.write(
|
||||
"Style._onPropertyChanged view:" + this._view +
|
||||
", property: " + property.name +
|
||||
", oldValue: " + oldValue +
|
||||
", newValue: " + newValue, trace.categories.Style);
|
||||
}
|
||||
|
||||
super._onPropertyChanged(property, oldValue, newValue);
|
||||
|
||||
@ -933,10 +935,14 @@ export class Style extends DependencyObservable implements styling.Style {
|
||||
var handler: definition.StylePropertyChangedHandler = getHandler(property, this._view);
|
||||
|
||||
if (!handler) {
|
||||
trace.write("No handler for property: " + property.name + " with id: " + property.id + ", view:" + this._view, trace.categories.Style);
|
||||
if (trace.enabled) {
|
||||
trace.write("No handler for property: " + property.name + " with id: " + property.id + ", view:" + this._view, trace.categories.Style);
|
||||
}
|
||||
}
|
||||
else {
|
||||
trace.write("Found handler for property: " + property.name + ", view:" + this._view, trace.categories.Style);
|
||||
if (trace.enabled) {
|
||||
trace.write("Found handler for property: " + property.name + ", view:" + this._view, trace.categories.Style);
|
||||
}
|
||||
|
||||
var shouldReset = false;
|
||||
if (property.metadata.equalityComparer) {
|
||||
@ -956,7 +962,9 @@ export class Style extends DependencyObservable implements styling.Style {
|
||||
}
|
||||
}
|
||||
catch (ex) {
|
||||
trace.write("Error setting property: " + property.name + " on " + this._view + ": " + ex, trace.categories.Style, trace.messageType.error);
|
||||
if (trace.enabled) {
|
||||
trace.write("Error setting property: " + property.name + " on " + this._view + ": " + ex, trace.categories.Style, trace.messageType.error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user