mirror of
https://github.com/HeyPuter/puter.git
synced 2026-01-09 22:51:29 -06:00
fix: apparently setters shadow getting
I thought you could:
method() {}
set method (v) { /* ... /* }
but you can't. You have to:
get method() { return (function () {}).bind(this) }
set method (v) { /* ... /* }
I don't know why a setter can't just only shadow setting, but that's
how they designed the language. ¯\_(ツ)_/¯
This commit is contained in:
committed by
KernelDeimos
parent
6ff3d154fa
commit
b328355a90
@@ -219,10 +219,12 @@ class Extension extends AdvancedBase {
|
||||
});
|
||||
}
|
||||
|
||||
preinit (callback) {
|
||||
this.on('preinit', callback);
|
||||
get preinit() {
|
||||
return (function (callback) {
|
||||
this.on('preinit', callback);
|
||||
}).bind(this);
|
||||
}
|
||||
set preinit (callback) {
|
||||
set preinit(callback) {
|
||||
if ( this.only_one_preinit_fn === null ) {
|
||||
this.on('preinit', (...a) => {
|
||||
this.only_one_preinit_fn(...a);
|
||||
@@ -233,9 +235,11 @@ class Extension extends AdvancedBase {
|
||||
}
|
||||
this.only_one_preinit_fn = callback;
|
||||
}
|
||||
|
||||
init (callback) {
|
||||
this.on('init', callback);
|
||||
|
||||
get init() {
|
||||
return (function(callback) {
|
||||
this.on('init', callback);
|
||||
}).bind(this);
|
||||
}
|
||||
set init (callback) {
|
||||
if ( this.only_one_init_fn === null ) {
|
||||
@@ -248,8 +252,6 @@ class Extension extends AdvancedBase {
|
||||
}
|
||||
this.only_one_init_fn = callback;
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
/**
|
||||
* This method will create the "default service" for an extension.
|
||||
|
||||
Reference in New Issue
Block a user