[
https://issues.apache.org/jira/browse/CB-9890?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14979607#comment-14979607
]
ASF GitHub Bot commented on CB-9890:
------------------------------------
Github user stevengill commented on a diff in the pull request:
https://github.com/apache/cordova-lib/pull/331#discussion_r43339261
--- Diff: cordova-common/README.md ---
@@ -20,12 +20,128 @@
-->
# cordova-common
-Contains shared classes and routines used by
[cordova-lib](https://github.com/apache/cordova-lib/) and platforms.
+Expoeses shared functionality used by
[cordova-lib](https://github.com/apache/cordova-lib/) and Cordova platforms.
+## Exposed APIs
+
+### `events`
+
+Represents special instance of NodeJS EventEmitter which is intended to be
used to post events to cordova-lib and cordova-cli
+
+Usage:
+```
+var events = require('cordova-common').events;
+events.emit('warn', 'Some warning message')
+```
+
+There are the following events supported by cordova-cli: `verbose`, `log`,
`info`, `warn`, `error`.
+
+### `CordovaError`
+
+An error class used by Cordova to throw cordova-specific errors. The
CordovaError class is inherited from Error, so CordovaError instances is also
valid Error instances (`instanceof` check succeeds).
+
+Usage:
+
+```
+var CordovaError = require('cordova-common').CordovaError;
+throw new CordovaError('Some error message', SOME_ERR_CODE);
+```
+
+See [CordovaError](src/CordovaError/CordovaError.js) for supported error
codes.
+
+### `ConfigParser`
+
+Exposes functionality to deal with cordova project `config.xml` files. For
ConfigParser API reference check [ConfigParser
Readme](src/ConfigParser/README.md).
+
+Usage:
+```
+var ConfigParser = require('cordova-common').ConfigParser;
+var appConfig = new ConfigParser('path/to/cordova-app/config.xml');
+console.log(appconfig.name() + ':' + appConfig.version());
+```
+
+### `PluginInfoProvider` and `PluginInfo`
+
+`PluginInfo` is a wrapper for cordova plugins' `plugin.xml` files. This
class may be instantiated directly or via `PluginInfoProvider`. The difference
is that `PluginInfoProvider` caches `PluginInfo` instances based on plugin
source directory.
+
+Usage:
+```
+var PluginInfo: require('cordova-common').PluginInfo;
+var PluginInfoProvider: require('cordova-common').PluginInfoProvider;
+
+// The following instances are equal
+var plugin1 = new PluginInfo('path/to/plugin_directory');
+var plugin2 = new PluginInfoProvider().get('path/to/plugin_directory');
+
+console.log('The plugin ' + plugin1.id + ' has version ' + plugin1.version)
+```
+
+### `ActionStack`
+
+Utility module for dealing with sequential tasks. Allow to provide a set
of tasks needs to be done and reverts all tasks that already completed if one
of tasks is failed to complete. Used internally by cordova-lib and platforms
plugin installation routines.
--- End diff --
Utility module for dealing with sequential tasks. Provides a set of tasks
that are needed to be done and reverts all tasks that are already completed if
one of those tasks fail to complete. Used internally by cordova-lib and
platform's plugin installation routines.
> Add documentaion about exposed APIs to cordova-common module
> ------------------------------------------------------------
>
> Key: CB-9890
> URL: https://issues.apache.org/jira/browse/CB-9890
> Project: Apache Cordova
> Issue Type: Improvement
> Components: CordovaCommon
> Affects Versions: 0.1.0
> Reporter: Vladimir Kotikov
> Assignee: Vladimir Kotikov
>
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]