Merge branch 'master' of gitea.iwm-tuebingen.de:IWMBrowser/iwmlib
This commit is contained in:
commit
d615158cf9
33
dist/iwmlib.js
vendored
33
dist/iwmlib.js
vendored
@ -1545,6 +1545,12 @@
|
||||
|
||||
}
|
||||
|
||||
const ipc = null;
|
||||
|
||||
try {
|
||||
ipc = require('electron').ipcRenderer;
|
||||
} catch (e) {}
|
||||
|
||||
/** Basic class for app specific logging requirements.
|
||||
* Can be used to implement persistent logging in electron apps.
|
||||
*/
|
||||
@ -1553,10 +1559,15 @@
|
||||
/** Static log function.
|
||||
* @param {*} message
|
||||
*/
|
||||
log(message) {
|
||||
static log(message) {
|
||||
|
||||
if (ipc) {
|
||||
ipc.send('log', message);
|
||||
} else {
|
||||
console.log(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* globals Hammer, propagating */
|
||||
|
||||
@ -2684,10 +2695,26 @@
|
||||
/**
|
||||
* Distincts if the app is running inside electron or not.
|
||||
*
|
||||
* source: https://discuss.atom.io/t/detect-electron-or-web-page-running/33180/3
|
||||
* source: https://github.com/cheton/is-electron
|
||||
*/
|
||||
static get isElectron() {
|
||||
return typeof process != 'undefined' && process.versions && process.versions.electron !== undefined
|
||||
|
||||
// Renderer process
|
||||
if (typeof window !== 'undefined' && typeof window.process === 'object' && window.process.type === 'renderer') {
|
||||
return true
|
||||
}
|
||||
|
||||
// Main process
|
||||
if (typeof process !== 'undefined' && typeof process.versions === 'object' && !!process.versions.electron) {
|
||||
return true
|
||||
}
|
||||
|
||||
// Detect the user agent when the `nodeIntegration` option is set to true
|
||||
if (typeof navigator === 'object' && typeof navigator.userAgent === 'string' && navigator.userAgent.indexOf('Electron') >= 0) {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
/** Returns the display resolution. Necessary for retina displays.
|
||||
|
33
dist/iwmlib.pixi.js
vendored
33
dist/iwmlib.pixi.js
vendored
@ -4709,6 +4709,12 @@
|
||||
// }
|
||||
}
|
||||
|
||||
const ipc = null;
|
||||
|
||||
try {
|
||||
ipc = require('electron').ipcRenderer;
|
||||
} catch (e) {}
|
||||
|
||||
/** Basic class for app specific logging requirements.
|
||||
* Can be used to implement persistent logging in electron apps.
|
||||
*/
|
||||
@ -4717,10 +4723,15 @@
|
||||
/** Static log function.
|
||||
* @param {*} message
|
||||
*/
|
||||
log(message) {
|
||||
static log(message) {
|
||||
|
||||
if (ipc) {
|
||||
ipc.send('log', message);
|
||||
} else {
|
||||
console.log(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* globals Hammer, propagating */
|
||||
|
||||
@ -5848,10 +5859,26 @@
|
||||
/**
|
||||
* Distincts if the app is running inside electron or not.
|
||||
*
|
||||
* source: https://discuss.atom.io/t/detect-electron-or-web-page-running/33180/3
|
||||
* source: https://github.com/cheton/is-electron
|
||||
*/
|
||||
static get isElectron() {
|
||||
return typeof process != 'undefined' && process.versions && process.versions.electron !== undefined
|
||||
|
||||
// Renderer process
|
||||
if (typeof window !== 'undefined' && typeof window.process === 'object' && window.process.type === 'renderer') {
|
||||
return true
|
||||
}
|
||||
|
||||
// Main process
|
||||
if (typeof process !== 'undefined' && typeof process.versions === 'object' && !!process.versions.electron) {
|
||||
return true
|
||||
}
|
||||
|
||||
// Detect the user agent when the `nodeIntegration` option is set to true
|
||||
if (typeof navigator === 'object' && typeof navigator.userAgent === 'string' && navigator.userAgent.indexOf('Electron') >= 0) {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
/** Returns the display resolution. Necessary for retina displays.
|
||||
|
@ -37,10 +37,26 @@ export class Capabilities {
|
||||
/**
|
||||
* Distincts if the app is running inside electron or not.
|
||||
*
|
||||
* source: https://discuss.atom.io/t/detect-electron-or-web-page-running/33180/3
|
||||
* source: https://github.com/cheton/is-electron
|
||||
*/
|
||||
static get isElectron() {
|
||||
return typeof process != 'undefined' && process.versions && process.versions.electron !== undefined
|
||||
|
||||
// Renderer process
|
||||
if (typeof window !== 'undefined' && typeof window.process === 'object' && window.process.type === 'renderer') {
|
||||
return true
|
||||
}
|
||||
|
||||
// Main process
|
||||
if (typeof process !== 'undefined' && typeof process.versions === 'object' && !!process.versions.electron) {
|
||||
return true
|
||||
}
|
||||
|
||||
// Detect the user agent when the `nodeIntegration` option is set to true
|
||||
if (typeof navigator === 'object' && typeof navigator.userAgent === 'string' && navigator.userAgent.indexOf('Electron') >= 0) {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
/** Returns the display resolution. Necessary for retina displays.
|
||||
|
22
lib/logging.html
Normal file
22
lib/logging.html
Normal file
@ -0,0 +1,22 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<title>Logging Doctest</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<link rel="stylesheet" href="./3rdparty/highlight/styles/default.css">
|
||||
<link rel="stylesheet" href="../css/doctest.css">
|
||||
<script src="./3rdparty/highlight/highlight.pack.js"></script>
|
||||
<script src="../dist/iwmlib.3rdparty.js"></script>
|
||||
<script src="../dist/iwmlib.js"></script>
|
||||
</head>
|
||||
|
||||
<body id="page" onload="Doctest.run()">
|
||||
<h1>
|
||||
Logging
|
||||
</h1>
|
||||
<p>Store informations of your app permanently.</p>
|
||||
<script class="doctest">
|
||||
Logging.log('app started')
|
||||
</script>
|
||||
</body>
|
@ -1,3 +1,9 @@
|
||||
const ipc = null
|
||||
|
||||
try {
|
||||
ipc = require('electron').ipcRenderer
|
||||
} catch (e) {}
|
||||
|
||||
/** Basic class for app specific logging requirements.
|
||||
* Can be used to implement persistent logging in electron apps.
|
||||
*/
|
||||
@ -6,7 +12,12 @@ export default class Logging {
|
||||
/** Static log function.
|
||||
* @param {*} message
|
||||
*/
|
||||
log(message) {
|
||||
static log(message) {
|
||||
|
||||
if (ipc) {
|
||||
ipc.send('log', message)
|
||||
} else {
|
||||
console.log(message)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "iwmlib",
|
||||
"version": "1.0.4",
|
||||
"version": "1.0.7",
|
||||
"description": "An Open Source library for multi-touch, WebGL powered applications.",
|
||||
"main": "index.js",
|
||||
"directories": {
|
||||
|
Loading…
Reference in New Issue
Block a user