refactor: use class static (#181)
diff --git a/lib/Api.js b/lib/Api.js
index 62e0a34..95e4cfa 100644
--- a/lib/Api.js
+++ b/lib/Api.js
@@ -357,24 +357,29 @@
const packageJson = getPackageJson();
return packageJson.version;
}
-}
-// @todo create projectInstance and fulfill promise with it.
-Api.updatePlatform = () => Promise.resolve();
-Api.createPlatform = (dest, config, options, events) => {
- if (!config) throw new CordovaError('An Electron platform can not be created with a missing config argument.');
-
- events = setupEvents(events);
-
- const name = config.name();
- const id = config.packageName();
-
- try {
- // we create the project using our scripts in this platform
- return require('./create').createProject(dest, id, name, options).then(() => new Api(null, dest, events));
- } catch (e) {
- events.emit('error', 'createPlatform is not callable from the electron project API.');
+ /**
+ * @todo create projectInstance and fulfill promise with it.
+ */
+ static updatePlatform () {
+ return Promise.resolve();
}
-};
+
+ static createPlatform (dest, config, options, events) {
+ if (!config) throw new CordovaError('An Electron platform can not be created with a missing config argument.');
+
+ events = setupEvents(events);
+
+ const name = config.name();
+ const id = config.packageName();
+
+ try {
+ // we create the project using our scripts in this platform
+ return require('./create').createProject(dest, id, name, options).then(() => new Api(null, dest, events));
+ } catch (e) {
+ events.emit('error', 'createPlatform is not callable from the electron project API.');
+ }
+ }
+}
module.exports = Api;