How to use the electron.remote.require function in electron

To help you get started, we’ve selected a few electron examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github symphonyoss / SymphonyElectron / js / preload / preloadMain.js View on Github external
*/
        setBadgeCount: function(count) {
            throttledSetBadgeCount(count);
        },

        /**
         * provides api similar to html5 Notification, see details
         * in notify/notifyImpl.js
         */
        Notification: remote.require('./notify/notifyImpl.js'),

        /**
         * provides api to allow user to capture portion of screen, see api
         * details in screenSnipper/index.js
         */
        ScreenSnippet: remote.require('./screenSnippet/index.js').ScreenSnippet,

        /**
         * Provides API to crash the renderer process that calls this function
         * Is only used for demos.
         */
        crashRendererProcess: function () {
            // For practical purposes, we don't allow
            // this method to work in non-dev environments
            if (!process.env.ELECTRON_DEV) {
                return;
            }
            process.crash();
        },

        /**
         * Provides api for client side searching
github sero-cash / wallet / modules / preloader / browser.js View on Github external
/**
@module preloader browser
*/
const _ = require('underscore');
require('./include/common')('browser');
const { ipcRenderer, webFrame, remote } = require('electron');
const mist = require('./include/mistAPI.js');
require('./include/getFavicon.js');
require('./include/getMetaTags.js');
require('./include/setBasePath')('interface');
const packageJson = require('./../../package.json');
const fs = remote.require('fs');
const path = remote.require('path');

// set navigator.language
Object.defineProperty(navigator, 'language', {
    get() { return ipcRenderer.sendSync('backendAction_getLanguage'); }
});

// notifiy the tab to store the webview id
ipcRenderer.sendToHost('setWebviewId');

const isValidJsonRpc = function (message) {
    return !!(Object.prototype.hasOwnProperty.call(message, 'method') ||
    Object.prototype.hasOwnProperty.call(message, 'id') ||
    Object.prototype.hasOwnProperty.call(message, 'params') ||
    Object.prototype.hasOwnProperty.call(message, 'jsonrpc'));
};
github jackd248 / electron-ampersand / js / app.js View on Github external
/**
 * Created by konradmichalik on 26.07.16.
 */
var remote = require('electron').remote;
var fs = remote.require('fs');
var ipc = require('electron').ipcRenderer;
var dialog = require('electron').remote.dialog;
var BrowserWindow = remote.BrowserWindow;
var localStorage = require('localStorage');
var JsonStorage = require('json-storage').JsonStorage;
var $ = require('jquery');
var Ps = require('perfect-scrollbar');
var store = JsonStorage.create(localStorage, 'markdown-ampersand', { stringify: true });
var md = require('markdown-it')({
    html:         true,        // Enable HTML tags in source
    xhtmlOut:     false,        // Use '/' to close single tags (<br>).
                                // This is only for full CommonMark compatibility.
    breaks:       false,        // Convert '\n' in paragraphs into <br>
    langPrefix:   'language-',  // CSS language prefix for fenced blocks. Can be
                                // useful for external highlighters.
    linkify:      true,        // Autoconvert URL-like text to links
github yoshuawuyts / vmd / renderer / main.js View on Github external
/* global vmd:true */

const { remote } = require('electron');

const url = remote.require('url');
const path = remote.require('path');
const fs = remote.require('fs');
const {
  shell,
  clipboard,
  nativeImage,
} = remote;
const conf = remote.getGlobal('conf');
const currentWindow = remote.getCurrentWindow();
const searchInPage = require('electron-in-page-search').default;
const renderMarkdown = require('./render-markdown');
const createMenu = require('../shared/create-menu');
const hist = require('./history')();
const zoom = require('./zoom')(conf.zoom);

const inPageSearch = searchInPage(remote.getCurrentWebContents());

hist.subscribe(() => {
github poooi / poi / views / components / settings / components / folder-picker.es View on Github external
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import { connect } from 'react-redux'
import fs from 'fs-extra'
import { get, split, map, size } from 'lodash'
import { remote } from 'electron'
import i18next from 'views/env-parts/i18next'
import path from 'path'
import { Position, Button, Intent, Classes, OverflowList, Tooltip } from '@blueprintjs/core'
import { withNamespaces } from 'react-i18next'
import styled from 'styled-components'
import FA from 'react-fontawesome'

import { isSubdirectory } from 'views/utils/tools'

const { dialog } = remote.require('electron')

const PickerBox = styled.div`
  display: flex;
  width: 100%;

  .bp3-overflow-list {
    flex: 1;
  }

  button {
    margin-left: 1em;
  }

  .bp3-breadcrumb {
    font-size: 12px;
  }
github blairjordan / pianoboi / src / renderer.js View on Github external
let { ipcRenderer, remote } = require("electron");
let main = remote.require("./main.js");
const midi = require("jzz");
const { signatures } = require("./signatures");
window.$ = window.jQuery = require("jquery");
const { Note, Array, Chord } = require("tonal");
const Key = require("tonal-key");
const Vex = require("vexflow");
const { centerPiano, buildKeyboard } = require("./piano");

$(function() {
  const VF = Vex.Flow;
  const renderer = new VF.Renderer(
    document.getElementById("sheetmusic"),
    VF.Renderer.Backends.SVG
  );
  const context = renderer.getContext();
github dmooney65 / fmradio / devfiles / fmRadio_srv.js View on Github external
const fs = require('fs');
const remote = require('electron').remote;
const main = remote.require('./main.js');
const sdrjs = require('sdrjs');
const arraybuffer = require('to-arraybuffer');
const decoder = new Worker('demodulator/decode-worker.js');
//const localPlayer = require('./localPlayer.js');
const upnpPlayer = require('./upnpPlayer.js');

let device;
let frequencyOffset = 0;
let isStereo = true;

const onBtn = document.getElementById('radio-on')
const offBtn = document.getElementById('radio-off')
const csdrBtn = document.getElementById('open-csdr')
const startBtn = document.getElementById('start')
const stopBtn = document.getElementById('stop')
const freqDownBtn = document.getElementById('freqDown')
github RuurdBijlsma / Ruurd-Movie-Maker / src / renderer / script.js View on Github external
const {
    remote
} = require('electron');
const {
    dialog
} = require('electron').remote;
const node = remote.require('./src/node/ffmpeg.js');
const mainProcess = remote.require('./src/node/main.js');
const tmpDir = '.tmp';

document.addEventListener("DOMContentLoaded", initialize);

function initialize() {
    video = new Video({
        videoPlayer: document.getElementsByClassName('video-player')[0],
        videoContainer: document.getElementsByClassName('video-container')[0],
        thumbnailContainer: document.getElementsByClassName('thumbnails')[0],
        seekProgress: document.getElementsByClassName('seek-progress')[0],
        seekThumb: document.getElementsByClassName('seek-thumb')[0],
        timeStamp: document.getElementsByClassName('time-stamp')[0],
        playButton: document.getElementsByClassName('play-button')[0],
        frameRateElement: document.getElementsByClassName('frame-rate')[0],
        durationElement: document.getElementsByClassName('duration')[0],
        fragmentControls: document.getElementsByClassName('fragment-controls')[0],
github Aedron / Page.qy / dist / login.js View on Github external
Function.prototype.toString = Object.prototype.toString;


import React from 'react';
import ReactDOM from 'react-dom';
import reactCSS from 'reactcss';
import { remote, shell } from 'electron';


const user = remote.require('./main.js').user;
const config = remote.require('./main.js').config;
const reGenerateAll = remote.require('./main.js').dataToHTML.reGenerateAll;
const platform = remote.require('./main.js').platform;
const app = remote.app;
const openURL = shell.openExternal;
const gitLink = {
    darwin: "https://sourceforge.net/projects/git-osx-installer/files/git-2.13.0-intel-universal-mavericks.dmg/download?use_mirror=autoselect",
    win32: "https://github.com/git-for-windows/git/releases/download/v2.13.0.windows.1/Git-2.13.0-64-bit.exe",
    linux: "https://git-scm.com/download/linux"
};


class App extends React.Component {
    constructor(props) {
        super(props);
        this.style = this.style.bind(this);
        this.handleOperate = this.handleOperate.bind(this);
        this.handleLogin = this.handleLogin.bind(this);
github poooi / poi / views / components / settings / about / update / download-progress.es View on Github external
import React, { Component } from 'react'
import { remote } from 'electron'
import { ProgressBar, Intent } from '@blueprintjs/core'
import { throttle } from 'lodash'
import { withNamespaces } from 'react-i18next'
import styled from 'styled-components'

const { updater } = remote.require('./lib/updater')

const Wrapper = styled.div`
  display: flex;
  white-space: nowrap;
  align-items: center;
`

const Indicator = styled.div`
  margin-left: 1em;
`

@withNamespaces(['setting'])
export class DownloadProgress extends Component {
  state = {
    bytesPerSecond: 0,
    percent: 0,