I have a web application that my client wants to wrap in an Electron app. I successfully created one that loads my website correctly. However, the default font gets changed to Times New Roman rather than the Helvetica Neue shown in Chrome (specified in my boostrap-customized.css).
I have looked through the Electron documentation and found the webPreferences object that contains the defaultFontFamily object which contains a string for each of standard, serif, sansSerif, monospace, cursive, and fantasy. My problem is finding an example of how to specify the value I want in there as part of the constructor to BrowserWindow(). I have tried both
webPreferences.defaultFontFamily.standard: 'Helvetica'
and
webPreferences:defaultFontFamily:standard: 'Helvetica'
with both giving me "SyntaxError: Unexpected token" on the first period or the second colon.
I'm sure it is some simple Javascript thing that I am unfamiliar with, or at least I'm hoping it is.
Indeed the problem is a simple JavaScript thing. Use =
to set the property value instead of a :
Example:
var obj = {
prop1: null,
prop2: {
prop: 'Hi'
}
};
//this works to set the values
obj.prop1 = 'dog';
obj.prop2.prop = 'cat';
//this doesnt work - uncomment the lines below will cause the same error you're getting
//obj.prop1: 'dog';
//obj.prop2.prop: 'cat';
console.log(obj);