Skip to content
Permalink
Browse files
feat(electron): add support (#135)
* feat(electron): add support
* style(lint): ignore electron/src/node_modules
* chore: git & npm ignore electron/src/{node_modules|package-lock.json}
* chore: add electron to cordova.platforms list in package.json
* chore(electron): bump systeminformation@5.11.9
  • Loading branch information
erisu committed Mar 31, 2022
1 parent 62277d5 commit f6cf8a6b98ce39fe53a0771d0fd58cd7837cba40
Showing 7 changed files with 79 additions and 8 deletions.
@@ -0,0 +1 @@
src/electron/node_modules
@@ -14,10 +14,4 @@ Thumbs.db

node_modules








src/electron/package-lock.json
@@ -1,2 +1,4 @@
.*
tests
src/electron/node_modules
src/electron/package-lock.json
@@ -7,6 +7,7 @@
"id": "cordova-plugin-device",
"platforms": [
"android",
"electron",
"ios",
"windows",
"browser",
@@ -20,6 +21,7 @@
"device",
"ecosystem:cordova",
"cordova-android",
"cordova-electron",
"cordova-ios",
"cordova-windows",
"cordova-browser",
@@ -34,7 +36,8 @@
"engines": {
"cordovaDependencies": {
"3.0.0": {
"cordova": ">100"
"cordova": ">100",
"cordova-electron": ">=3.0.0"
}
}
},
@@ -30,6 +30,10 @@
<repo>https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git</repo>
<issue>https://issues.apache.org/jira/browse/CB/component/12320648</issue>

<engines>
<engine name="cordova-electron" version=">=3.0.0" />
</engines>

<js-module src="www/device.js" name="device">
<clobbers target="device" />
</js-module>
@@ -57,6 +61,11 @@
<source-file src="src/ios/CDVDevice.m" />
</platform>

<!-- electron -->
<platform name="electron">
<framework src="src/electron" />
</platform>

<!-- windows -->
<platform name="windows">
<js-module src="src/windows/DeviceProxy.js" name="DeviceProxy">
@@ -0,0 +1,42 @@
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/

const { system, osInfo } = require('systeminformation');

module.exports = {
getDeviceInfo: async () => {
try {
const { manufacturer, model, uuid } = await system();
const { platform, distro, codename, build: version } = await osInfo();

return {
manufacturer,
model,
platform: platform === 'darwin' ? codename : distro,
version,
uuid,
isVirtual: false
};
} catch (e) {
console.log(e);
}
}
};
@@ -0,0 +1,20 @@
{
"name": "cordova-plugin-device-electron",
"version": "1.0.0",
"description": "Electron Native Supprot for Cordova Device Plugin",
"main": "index.js",
"keywords": [
"cordova",
"electron",
"device",
"native"
],
"author": "Apache Software Foundation",
"license": "Apache-2.0",
"dependencies": {
"systeminformation": "^5.11.9"
},
"cordova": {
"serviceName": "Device"
}
}

0 comments on commit f6cf8a6

Please sign in to comment.