From 7f07e4d424de1c13130d06d54acbe5f07736510c Mon Sep 17 00:00:00 2001
From: Jake <jake.read@cba.mit.edu>
Date: Wed, 27 Mar 2019 16:38:01 -0400
Subject: [PATCH] more help, now back to views that expand

---
 bootstrap.js         |  2 ++
 hunks/hidden/view.js |  8 +++-----
 hunks/manager.js     | 41 ++---------------------------------------
 3 files changed, 7 insertions(+), 44 deletions(-)

diff --git a/bootstrap.js b/bootstrap.js
index a7bd14c..f2ee890 100644
--- a/bootstrap.js
+++ b/bootstrap.js
@@ -19,6 +19,8 @@ let NROL = new Manager()
 NROL.name = 'manager'
 NROL.id = 'NROL39_0'
 NROL.init()
+// this is going to sit in the outbuffer until the view resolves
+NROL.sendHunkAsDef(NROL)
 
 function bootloop() {
     NROL.loop()
diff --git a/hunks/hidden/view.js b/hunks/hidden/view.js
index 6af366a..f734935 100644
--- a/hunks/hidden/view.js
+++ b/hunks/hidden/view.js
@@ -220,7 +220,7 @@ function View() {
             // donot
         } else {
             // case for adding / rming from sim 
-            console.log('UPD8 Force Sim')
+            this.log('UPD8 Force Sim')
             let positions = this.getAllHunkPositions()
             if (positions.length > flnodes.length) {
                 let last = positions.length - 1
@@ -389,14 +389,12 @@ function View() {
         // not interested in adding the top level's view to itself
         // TODO probably this is a bugfarm when we go to nest views 
         if (def.dom !== null && def.dom !== undefined && def.id !== 'TLView') {
-            console.log('a cuttlefish hunk appears')
+            this.log(`${def.id} UI DOM appears...`, def.dom)
             try {
                 $(de).append($(def.dom).addClass('cuttlefishhunkdom'))
             } catch (err) {
                 console.log('error while appending cfhnk to dom', err)
             }
-        } else {
-            console.log('dom w/o cuttlefish')
         }
         writeTransform(de, mt)
         // rm menu if it's around 
@@ -747,10 +745,10 @@ function View() {
             // for bringing the dom element over *which is specific to a native manager* 
             // so TODO: add switch for native / nonative managers 
             let data = this.inputs.msgs.data
-            console.log(this.id, 'has msg', data)
             let pult = this.inputs.msgs.get()
             let header = data.header
             let content = data.content
+            this.log(`gets msg ${header}`)
             switch (header) {
                 case 'putcontextoptions':
                     addContextOptions(content)
diff --git a/hunks/manager.js b/hunks/manager.js
index 7ec23aa..2fd7de0 100644
--- a/hunks/manager.js
+++ b/hunks/manager.js
@@ -4,41 +4,6 @@ js context manager
 
 */
 
-/*
-node imports 
-const Hunk = require('./hunk.js')
-let Hunkify = Hunk.Hunkify
-let Input = Hunk.Input
-let Output = Hunk.Output
-let State = Hunk.State
-
-const fs = require('fs')
-*/
-
-// code should remain identical to node implementation \/
-/* changes made 
-
- - process.hrtime() / profiling is gone 
-  - profiling question: does not-calling to process.hrtime() reduce the 100% duty cycle on the cpu ?
-  - running this in the browser with .setimmediate() does *not* poll the cpu all crazy like 
- - fs. does not exist ... 
- - 
-
-*/
-
-/*
-
-browser manager *also contains* mucho UI state
-i.e. it contains a mirrored list of views ... having def's which are doms 
-
-*/
-
-// at the moment: making this header match others, 
-// maybe Hunkify.writeDefinition(hunk) or something 
-// and then abstracting fs out, and unfucking logs (in hunkify as well) 
-// and then scrape and go, and back to watching view to open up...
-// towards ... we need to feel confident here, before we can describe messages and plan for cpp 
-
 import { Hunkify, Input, Output, State } from './hunks.js'
 
 import GoGetter from '../gogetter.js'
@@ -447,9 +412,7 @@ function Manager() {
         // startup by giving ourselves an ID if we haven't been assigned one?
         // and then adding ourselves to ourselves ? 
         hunks.push(this)
-        this.log('manager hello, id is', this.id)
-        console.log(hunks)
-        this.log(hunks)
+        this.log(`manager hello, id is ${this.id}`)
     }
 
     this.loop = () => {
@@ -457,7 +420,7 @@ function Manager() {
             let msg = this.inputs.msgs.get()
             let header = msg.header
             let content = msg.content
-            console.log(this.id, 'has msg', msg)
+            this.log(`gets msg ${header}`)
             switch (header) {
                 case 'hello':
                     let options = this.getHelloResponses()
-- 
GitLab