npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

angular-electron

v0.2.1

Published

angularjs helpers for electron apps

Downloads

118

Readme

angular-electron

angularjs helpers for electron apps

Installation

npm install angular-electron
bower install angular-electron

Use 0.1.x for electron < 0.35.0 and 0.2.x for electron > 0.35.0

Usage

<body>
   <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script>
   <script src="angular-electron.js"></script>
 </body>
angular.module('myModule', ['angular-electron']);

API

renderer modules

These are all the renderer modules that are available as angular services:

desktopCapturer, ipcRenderer, webFrame, clipboard, crashReporter, nativeImage, screen, shell

To use them, simply inject them to your components:

angular.module('myModule').controller('myCtrl', ['shell', function(shell) {
  shell.showItemInFolder(pathToItem);
}]);

remote and node modules

These are all the main modules that are available as angular services:

app, autoUpdater, BrowserWindow, contentTracing, dialog, globalShortcut, Menu, MenuItem, powerMonitor, powerSaveBlocker, protocol, webContents, tray

Node modules:

buffer, child_process, cluster, crypto, dns, events, fs, http, https, net, os, path, punycode, querystring, readline, stream, string_decoder, tls, dgram, url, util, v8, vm, zlib

All of the modules are lazy required (required only on use).

remoteProvider

In order to use a node package (e.g. moment), use the remoteProvider to register the package to an angular service.

angular.module('myModule').config(['remoteProvider', function(remoteProvider) {
  remoteProvider.register('moment');
}]);

or

angular.module('myModule').config(['remoteProvider', function(remoteProvider) {
  remoteProvider.register({name: 'newName', require: 'moment'});
}]);

then inject it as a regular service

angular.module('myModule').controller('myCtrl', ['moment', function(moment) {

}]);

or

angular.module('myModule').controller('myCtrl', ['newName', function(moment) {

}]);

You can also register a module by function:

angular.module('myModule').config(['remoteProvider', function(remoteProvider) {
  remoteProvider.register('exec', function(remote) {
    return remote.require('child_process').exec;
  });
}]);

then use it

angular.module('myModule').controller('myCtrl', ['exec', function(exec) {
    exec('ls');
}]);

process objects

electron process objects are available as angularjs constants.

angular.module('myModule').controller('myCtrl', ['process', 'remoteProcess',
function(process, remoteProcess) {

}]);

current window

The current window is also available as angularjs constant.

angular.module('myModule').controller('myCtrl', ['currentWindow',
function(currentWindow) {

}]);

current web contents

The current web contents module is also available as angularjs constant.

angular.module('myModule').controller('myCtrl', ['currentWebContents',
function(currentWebContents) {

}]);

external link

This is a directive which opens a link in the default desktop browser.

<a href="https://google.com" external-link>google</a>
<button external-link="https://google.com">google</button>

safe shutdown

safe shutdown is a service which handles pre-shudown actions.

angular.module('myModule').controller('myCtrl', ['safeShutdown',
function(safeShutdown) {
  safeShutdown.register(function() {
    logout();
  });
}]);

The function can return a promise to handle async operations.

You can register multiple functions

Then use currentWindow.safeReload or app.safeQuit to reload/quit your app.

These methods are available only after safeShutdown is instantiated.