Skip to content

Instantly share code, notes, and snippets.

@stryju

stryju/esnextbin.md

Created Jan 12, 2017
Embed
What would you like to do?
esnextbin sketch
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>ESNextbin Sketch</title>
<style>
html, body {
margin: 0;
padding: 0;
}
form {
width: 100vw;
height: 100vh;
display: flex;
flex-flow: row nowrap;
}
form > * {
flex: 1;
overflow: auto;
}
pre, textarea {
margin: 0;
padding: .25em;
font: 12px/14px Fira Code, monospace;
border: 0;
}
</style>
</head>
<body>
<form id="f">
<textarea id="in" placeholder="pase SDP here"></textarea>
<pre><output id="out"></output></pre>
</form>
</body>
</html>
const transform = require('sdp-transform');
const form = document.getElementById('f');
const input = document.getElementById('in');
const output = document.getElementById('out');
f.addEventListener('submit', ev => ev.preventDefault);
input.addEventListener('input', ({target}) => output.value = JSON.stringify(transform.parse(target.value), null, 2), true);
{
"name": "esnextbin-sketch",
"version": "0.0.0",
"dependencies": {
"sdp-transform": "1.7.0",
"babel-runtime": "6.20.0"
}
}
'use strict';
var _stringify = require('babel-runtime/core-js/json/stringify');
var _stringify2 = _interopRequireDefault(_stringify);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var transform = require('sdp-transform');
var form = document.getElementById('f');
var input = document.getElementById('in');
var output = document.getElementById('out');
f.addEventListener('submit', function (ev) {
return ev.preventDefault;
});
input.addEventListener('input', function (_ref) {
var target = _ref.target;
return output.value = (0, _stringify2.default)(transform.parse(target.value), null, 2);
}, true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment