From fe0903b28ed2f8c983b165f3979252d925c9d138 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Mon, 27 Apr 2020 16:54:44 +0300 Subject: [PATCH] minor tweaks... Signed-off-by: Alex A. Naanou --- object.js | 8 +++++--- package.json | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/object.js b/object.js index c99aaf4..73957e4 100755 --- a/object.js +++ b/object.js @@ -398,6 +398,9 @@ function(context, constructor, ...args){ // it via. Object.create(..) or copy it... // // XXX EXPERIMENTAL: calling .__rawinstance__(..) to create an instance... +// NOTE: to disable .__rawinstance__(..) handling set it to false in the +// class prototype... +// // XXX Q: should the context in .__new__(..) be _constructor or .prototype??? // ...currently it's .prototype... var Constructor = @@ -413,7 +416,7 @@ function Constructor(name, a, b){ var _constructor = function Constructor(){ // create raw instance... var obj = _constructor.__rawinstance__ ? - _constructor.__rawinstance__(this, ...arguments) + _constructor.__rawinstance__(this, ...arguments) : makeRawInstance(this, _constructor, ...arguments) // initialize... obj.__init__ instanceof Function @@ -432,7 +435,6 @@ function Constructor(name, a, b){ // set .toString(..)... // NOTE: do this only if .toString(..) is not defined by user... ;((cls_proto || {}).toString() == ({}).toString()) - // XXX is this the right way to go or should we set this openly??? && Object.defineProperty(_constructor, 'toString', { value: function(){ var args = proto.__init__ ? @@ -452,7 +454,7 @@ function Constructor(name, a, b){ _constructor.prototype = proto // XXX EXPERIMENTAL... // generic raw instance constructor... - _constructor.__rawinstance__ + _constructor.__rawinstance__ instanceof Function || (_constructor.__rawinstance__ = function(context, ...args){ return makeRawInstance(context, this, ...args) }) diff --git a/package.json b/package.json index 0f914af..ed13d5d 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ig-object", - "version": "2.4.5", + "version": "2.4.6", "description": "", "main": "object.js", "scripts": {