Commit 8c3a3154 authored by Boxiang Sun's avatar Boxiang Sun

erp5_notebook: Follow the nexedi JS coding style

parent d45d5832
...@@ -3,11 +3,11 @@ ...@@ -3,11 +3,11 @@
(function (window) { (function (window) {
"use strict"; "use strict";
function sideEffectDiv(sideEffectClass, reportSideEffect) { function sideEffectDiv(side_effect_class, report_side_effect) {
// appends a side effect div to the side effect area // appends a side effect div to the side effect area
var div = document.createElement("div"); var div = document.createElement("div");
div.setAttribute("class", sideEffectClass); div.setAttribute("class", side_effect_class);
if (reportSideEffect === undefined) { if (report_side_effect === undefined) {
div.setAttribute("style", "display:"); div.setAttribute("style", "display:");
} }
document.body.appendChild(div); document.body.appendChild(div);
...@@ -17,19 +17,19 @@ ...@@ -17,19 +17,19 @@
var IODide = function createIODide() { var IODide = function createIODide() {
var iodide = { var iodide = {
output: { output: {
text: function (content, reportSideEffect) { text: function (content, report_side_effect) {
var i, div, line_list; var i, div, line_list;
console.log(content); console.log(content);
line_list = content.toString().split("\n"); line_list = content.toString().split("\n");
for (i = 0; i < line_list.length; i += 1) { for (i = 0; i < line_list.length; i += 1) {
div = sideEffectDiv("side-effect-print", reportSideEffect); div = sideEffectDiv("side-effect-print", report_side_effect);
div.textContent = line_list[i]; div.textContent = line_list[i];
} }
}, },
element: function (nodeType, reportSideEffect) { element: function (node_type, report_side_effect) {
var div, node; var div, node;
div = sideEffectDiv("side-effect-element", reportSideEffect); div = sideEffectDiv("side-effect-element", report_side_effect);
node = document.createElement(nodeType); node = document.createElement(node_type);
div.append(node); div.append(node);
return node; return node;
} }
...@@ -479,7 +479,7 @@ ...@@ -479,7 +479,7 @@
}); });
} }
function loadPyodide(info, receiveInstance) { function loadPyodide(info, receive_instance) {
var queue = new RSVP.Queue(); var queue = new RSVP.Queue();
queue.push(function () { queue.push(function () {
return ajax({ return ajax({
...@@ -491,7 +491,7 @@ ...@@ -491,7 +491,7 @@
return WebAssembly.instantiate(evt.target.response, info); return WebAssembly.instantiate(evt.target.response, info);
}) })
.push(function (results) { .push(function (results) {
return receiveInstance(results.instance); return receive_instance(results.instance);
}) })
.push(undefined, function (error) { .push(undefined, function (error) {
console.log(error); console.log(error);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment