https://github.com/harmon25/meteor-josh-js
Josh.js (Java Online-Shell) Meteor Package
https://github.com/harmon25/meteor-josh-js
Last synced: 24 days ago
JSON representation
Josh.js (Java Online-Shell) Meteor Package
- Host: GitHub
- URL: https://github.com/harmon25/meteor-josh-js
- Owner: harmon25
- License: apache-2.0
- Created: 2015-09-10T14:50:23.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2015-09-13T17:42:36.000Z (almost 11 years ago)
- Last Synced: 2025-12-28T15:00:35.454Z (6 months ago)
- Language: JavaScript
- Size: 168 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# meteor-josh-js
[Josh.js](https://sdether.github.io/josh.js/) (Java Online-Shell) Meteor Package
* Many thanks to [sdether](https://github.com/sdether/josh.js) for creating josh.js :)
# Usage
* Provides Josh object to client globablly
## Blaze Template
### Encapsulate Josh within a blaze template
```html
```
### Initialize Josh
```javascript
Template.JoshTemplate.onCreated(function(){
var history = Josh.History();
var killring = new Josh.KillRing();
var readline = new Josh.ReadLine({history: history, killring: killring });
var jShellConfig = {readline: readline,
history: history,
shell_view_id: this.data.viewid,
shell_panel_id: this.data.panelid,
prompt: this.data.prompt
}
jShell = new Josh.Shell(jShellConfig);
// Set commandHandlers & optionally configure pathhandler(s)
...
...
});
```
## Create blaze attribute helper
```javascript
Template.JoshTemplate.helpers({
atts: function JoshTplAtts() {
var val, Attributes = {}, context = this;
for (var prop in context) {
val = context[prop];
if (!_.isArray(val) && !_.isObject(val)) {
Attributes[prop] = val;
}
}
return Attributes;
}
});
```
### Activate josh
```javascript
Template.JoshTemplate.onRendered(function(){
jShell.activate()
});
```
### Use blaze template anywhere
```html
{{> JoshTemplate viewid="shell-view" panelid="shell-panel" prompt="jsh$"}}
```