Build Copay for OSX, Linux and Windows
This commit is contained in:
parent
f14aeaef0c
commit
c0b496c7e7
15 changed files with 759 additions and 101 deletions
42
src/js/services/nodeWebkit.js
Normal file
42
src/js/services/nodeWebkit.js
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.services').factory('nodeWebkit', function nodeWebkitFactory() {
|
||||
var root = {};
|
||||
|
||||
var isNodeWebkit = function() {
|
||||
var isNode = (typeof process !== "undefined" && typeof require !== "undefined");
|
||||
if(isNode) {
|
||||
try {
|
||||
return (typeof require('nw.gui') !== "undefined");
|
||||
} catch(e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
root.isDefined = function() {
|
||||
return isNodeWebkit();
|
||||
};
|
||||
|
||||
root.readFromClipboard = function() {
|
||||
if (!isNodeWebkit()) return;
|
||||
var gui = require('nw.gui');
|
||||
var clipboard = gui.Clipboard.get();
|
||||
return clipboard.get();
|
||||
};
|
||||
|
||||
root.writeToClipboard = function(text) {
|
||||
if (!isNodeWebkit()) return;
|
||||
var gui = require('nw.gui');
|
||||
var clipboard = gui.Clipboard.get();
|
||||
return clipboard.set(text);
|
||||
};
|
||||
|
||||
root.openExternalLink = function(url) {
|
||||
if (!isNodeWebkit()) return;
|
||||
var gui = require('nw.gui');
|
||||
return gui.Shell.openExternal(url);
|
||||
};
|
||||
|
||||
return root;
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue