Webcontents.setframerate is not a function


#1

I have installed the latest recommended build of Node and Electron. I am trying to change the frame rate of a BrowserWindow to see if it affects the performance of an app.

The app in question is running locked at a low frame rate on all OSX machines and I’m trying to discover why. My first thought was to see if I could alter the frame rate of the app.

I tried and I get the following error:

Uncaught Exception:
TypeError: win.webContents.setFrameRate is not a function
at EventEmitter.<anonymous> (/Users/st33d/Documents/js/electron/02/main.js:19:21)
at emitOne (events.js:82:20)
at EventEmitter.emit (events.js:169:7)

This is the code I used to open the window:

var app = require('app');  // Module to control application life.
var BrowserWindow = require('browser-window');  // Module to create native browser window.

var win = null;

app.on('ready', function() {
    
    win = new BrowserWindow({
        width: 900, height: 600
    });

    win.loadURL('file://' + __dirname + '/index.html');
    
    win.webContents.on('did-finish-load', function() {
        win.webContents.executeJavaScript("alert('Hello There!');");
        win.webContents.openDevTools();
    });
    
    win.webContents.setFrameRate(30);
    
    win.on('closed', function() {
        win = null;
    });
});

I have followed whatever documentation I could find as best as I could. But most of the docs only list fragments of programs - so I’ve no idea if I’ve left anything out.