diff options
-rwxr-xr-x | twittperator/dump-msg.tw | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/twittperator/dump-msg.tw b/twittperator/dump-msg.tw new file mode 100755 index 0000000..7de3c34 --- /dev/null +++ b/twittperator/dump-msg.tw @@ -0,0 +1,31 @@ +/* + * Please write the below line into .vimperatorrc. + * let g:twittperator_plugin_dump_msg = 1 + */ + + +(function () { + function objectToString (obj, head) { + if (!head) + head = ''; + + let result = ''; + for (let [n, v] in Iterator(obj)) { + if (v && typeof v === 'object') { + result += head + n + ':\n' + objectToString(v, head + ' '); + } else { + result += head + n + ': ' + v + '\n'; + } + } + + return result; + } + + plugins.twittperator.ChirpUserStream.addListener( + function onMsg (msg, raw) { + liberator.log('\n' + objectToString(msg)); + } + ); +})(); + +// vim: sw=2 ts=2 et fdm=marker ft=javascript: |