made with esnextbin
Created
January 12, 2017 10:50
-
-
Save stryju/1a3057daaead28bca5ec6d6df9a736b9 to your computer and use it in GitHub Desktop.
esnextbin sketch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "esnextbin-sketch", | |
"version": "0.0.0", | |
"dependencies": { | |
"sdp-transform": "1.7.0", | |
"babel-runtime": "6.20.0" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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