build: allow use of BUILDFLAG directives from within JS code (#20328)
This commit is contained in:
parent
f9c04449f4
commit
392ea320cf
16 changed files with 132 additions and 74 deletions
|
@ -1,6 +1,5 @@
|
|||
'use strict';
|
||||
|
||||
const features = process.electronBinding('features');
|
||||
const { EventEmitter } = require('events');
|
||||
const electron = require('electron');
|
||||
const path = require('path');
|
||||
|
@ -341,7 +340,7 @@ WebContents.prototype.printToPDF = function (options) {
|
|||
printSettings.scaleFactor = Math.ceil(printSettings.scaleFactor) % 100;
|
||||
// PrinterType enum from //printing/print_job_constants.h
|
||||
printSettings.printerType = 2;
|
||||
if (features.isPrintingEnabled()) {
|
||||
if (this._printToPDF) {
|
||||
return this._printToPDF(printSettings);
|
||||
} else {
|
||||
const error = new Error('Printing feature is disabled');
|
||||
|
@ -375,7 +374,7 @@ WebContents.prototype.print = function (options = {}, callback) {
|
|||
}
|
||||
}
|
||||
|
||||
if (features.isPrintingEnabled()) {
|
||||
if (this._print) {
|
||||
if (callback) {
|
||||
this._print(options, callback);
|
||||
} else {
|
||||
|
@ -387,7 +386,7 @@ WebContents.prototype.print = function (options = {}, callback) {
|
|||
};
|
||||
|
||||
WebContents.prototype.getPrinters = function () {
|
||||
if (features.isPrintingEnabled()) {
|
||||
if (this._getPrinters) {
|
||||
return this._getPrinters();
|
||||
} else {
|
||||
console.error('Error: Printing feature is disabled.');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue