Skip to content

Instantly share code, notes, and snippets.

@mihailik mihailik/index.html
Last active Nov 10, 2018

Embed
What would you like to do?
<html>
<head><title>Folding freeze demo</title>
<link rel=stylesheet href='//cdn.rawgit.com/codemirror/CodeMirror/07779394f3d5b756abc2f54e15999134627436a7/lib/codemirror.css'>
<script src='//cdn.rawgit.com/codemirror/CodeMirror/07779394f3d5b756abc2f54e15999134627436a7/lib/codemirror.js'></script>
<link rel=stylesheet href='//cdn.rawgit.com/codemirror/CodeMirror/07779394f3d5b756abc2f54e15999134627436a7/addon/fold/foldgutter.css'>
<script src='//cdn.rawgit.com/codemirror/CodeMirror/07779394f3d5b756abc2f54e15999134627436a7/addon/fold/foldcode.js'></script>
<script src='//cdn.rawgit.com/codemirror/CodeMirror/07779394f3d5b756abc2f54e15999134627436a7/addon/fold/foldgutter.js'></script>
<script src='//cdn.rawgit.com/codemirror/CodeMirror/07779394f3d5b756abc2f54e15999134627436a7/addon/fold/brace-fold.js'></script>
<script src='//cdn.rawgit.com/codemirror/CodeMirror/07779394f3d5b756abc2f54e15999134627436a7/mode/javascript/javascript.js'></script>
</head>
<body>
<script>
var cm = CodeMirror(document.body, {
mode: 'application/json',
foldGutter: true,
gutters: ["CodeMirror-foldgutter"]
});
var largeJson = [];
largeJson.push('[');
var count = 10000;
for (var i = 0; i < count; i++) {
largeJson.push('{\n'+
' "name": '+i+',\n'+
' "Monday": 20151026,\n'+
' "Tuesday": 20151027,\n'+
' "Wednesday": 20151028,\n'+
' "Thirsday": 20151029,\n'+
' "Friday": 20151030,\n'+
' "Saturday": 20151031,\n'+
' "Sunday": 20151101\n'+
'\n}'+(i<count-1?',':''));
}
largeJson.push(']');
var jsonText = largeJson.join('\n');
var start = Date.now();JSON.parse(jsonText);console.log((Date.now()-start)+' to parse');
cm.setValue(jsonText);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.