-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.js
42 lines (34 loc) · 899 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
'use strict';
const platform = require('electron-platform');
if ( platform.isMainProcess ) {
// init electron-ipc-plus in main process
require('electron-ipc-plus');
return;
}
function _getPropertyDescriptor(obj, name) {
if (!obj) {
return null;
}
let pd = Object.getOwnPropertyDescriptor(obj, name);
return pd || _getPropertyDescriptor(Object.getPrototypeOf(obj), name);
}
function _copyprop(name, source, target) {
let pd = _getPropertyDescriptor(source, name);
Object.defineProperty(target, name, pd);
}
module.exports = {
drag: require('./lib/drag'),
droppable: require('./lib/droppable'),
addon (obj, ...args) {
obj = obj || {};
for (let i = 0; i < args.length; ++i) {
let source = args[i];
for ( let name in source) {
if ( !(name in obj) ) {
_copyprop( name, source, obj);
}
}
}
return obj;
}
};