https://github.com/cloudcmd/cloudcmd-plugin
Example of using plugins in Cloud Commander
https://github.com/cloudcmd/cloudcmd-plugin
cloudcmd javascript nodejs plugin runkit
Last synced: 8 months ago
JSON representation
Example of using plugins in Cloud Commander
- Host: GitHub
- URL: https://github.com/cloudcmd/cloudcmd-plugin
- Owner: cloudcmd
- Created: 2016-11-30T12:23:29.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2016-12-01T09:56:26.000Z (about 9 years ago)
- Last Synced: 2024-12-25T13:42:46.528Z (about 1 year ago)
- Topics: cloudcmd, javascript, nodejs, plugin, runkit
- Language: JavaScript
- Homepage:
- Size: 30.3 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Cloud Commander Plugin
If you ever dreamed about having ability to expose functionality of `Cloud Commander`, now your dreams came true:
with help of `plugins` field in `options` you can specify client-side js files, that will be loaded strict after load of `Cloud Commander`.
```js
app.use(cloudcmd({
plugins: [
__dirname + '/' + 'plugin.js'
]
}));
```

On a client we going to embed [RunKit](https://runkit.com/docs/embed "RunKit").
Next code loads necessary files, viewer and puts `RunKit` to viewer.
Let's take a look at `plugin.js`.
```js
'use strict';
const element = document.createElement('div');
exec.series([
loadRunKit,
notebook,
CloudCmd.View,
init,
]);
function loadRunKit(fn) {
load.js('https://embed.runkit.com', fn);
}
function notebook(fn) {
fn();
RunKit.createNotebook({
element,
source: 'js source'
});
}
function init() {
CloudCmd.View.show(element, {
autoSize: true
});
}
}
```
# Try at home
You can try everything on your local host.
Just clone the repo and start process.
```
git clone https://github.com/cloudcmd/cloudcmd-plugin.git
cd cloudcmd-plugin && npm install
node index.js
```
# License
MIT