-
-
Notifications
You must be signed in to change notification settings - Fork 571
renderHandler option that will allow to echo different types of data in one place #526
Copy link
Copy link
Closed
Labels
featureresolvedif issue is resolved, it will be open until merge with masterif issue is resolved, it will be open until merge with master
Description
I have idea for a new feature for jQuery Terminal
Global echoHandler or renderHandler:
term.echo({xx:10});this will render [Object object]
I'm thinking about:
renderHandler: function(obj) {
if (typeof obj !== 'string' && obj !(instanceof Array)) {
if (obj !== null && typeof obj === 'object') {
this.echo('[[;;;json]x]', {
finalize: function(div) {
var node = div.find('.json');
var new_div = $('<div/>').renderJSON(obj);
node.replaceWith(new_div);
}
});
}
return false;
}
}and this can render any object that is passed to echo, as with this Demo: https://codepen.io/jcubic/pen/yLBjJRp?editors=0110
this will be really powerfull because you will be able to render for instance JSX code after transpilation, Maybe this can be simplified to have render method that will allow to use syntax like this:
this.render(function(div) {
});and render will just do:
render: function(fn) {
this.echo('', {
finalize: function(div) {
fn.call(this, div.empty()));
}
});
}TODO:
- Create POC of rendering React App inside terminal echo
- Figure out to not re render on each resize
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
featureresolvedif issue is resolved, it will be open until merge with masterif issue is resolved, it will be open until merge with master