Message from JavaScript discussions

December 2017

— But I don't want to create new functions on each kernel instance

— 

Hm, why does this not work well?

Object.keys(tests).reduce(
(acc, name) =>
acc[name] = tests[name].bind(this),
{}
);

— Gets me a weird result

— 

var t = new testClass();
t.boundTests
ƒ () {
console.log(this.thing);
}

— Welp it's frustrating to see reduce not work, haha

— Went with this instead of reduce:

Object.keys(tests).forEach(
name =>
this.boundTests[name] = tests[name].bind(this)
);

Message permanent page

— I was missing rest operator somewhere but at that point forEach is simpler

— Heh, that would work, if I used singletons in the Kernel

— This works pretty well

— 

for (var name in this.prototype.SCP) {
this.SCP[name] = this.prototype.SCP[name].bind(this);
};

— Ayy

— Made a little utility function that does it for me