mirror of
https://github.com/flynx/object.js.git
synced 2025-11-01 03:50:09 +00:00
minor tweaks...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
8d3e701d4c
commit
fe0903b28e
@ -398,6 +398,9 @@ function(context, constructor, ...args){
|
|||||||
// it via. Object.create(..) or copy it...
|
// it via. Object.create(..) or copy it...
|
||||||
//
|
//
|
||||||
// XXX EXPERIMENTAL: calling .__rawinstance__(..) to create an instance...
|
// 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???
|
// XXX Q: should the context in .__new__(..) be _constructor or .prototype???
|
||||||
// ...currently it's .prototype...
|
// ...currently it's .prototype...
|
||||||
var Constructor =
|
var Constructor =
|
||||||
@ -413,7 +416,7 @@ function Constructor(name, a, b){
|
|||||||
var _constructor = function Constructor(){
|
var _constructor = function Constructor(){
|
||||||
// create raw instance...
|
// create raw instance...
|
||||||
var obj = _constructor.__rawinstance__ ?
|
var obj = _constructor.__rawinstance__ ?
|
||||||
_constructor.__rawinstance__(this, ...arguments)
|
_constructor.__rawinstance__(this, ...arguments)
|
||||||
: makeRawInstance(this, _constructor, ...arguments)
|
: makeRawInstance(this, _constructor, ...arguments)
|
||||||
// initialize...
|
// initialize...
|
||||||
obj.__init__ instanceof Function
|
obj.__init__ instanceof Function
|
||||||
@ -432,7 +435,6 @@ function Constructor(name, a, b){
|
|||||||
// set .toString(..)...
|
// set .toString(..)...
|
||||||
// NOTE: do this only if .toString(..) is not defined by user...
|
// NOTE: do this only if .toString(..) is not defined by user...
|
||||||
;((cls_proto || {}).toString() == ({}).toString())
|
;((cls_proto || {}).toString() == ({}).toString())
|
||||||
// XXX is this the right way to go or should we set this openly???
|
|
||||||
&& Object.defineProperty(_constructor, 'toString', {
|
&& Object.defineProperty(_constructor, 'toString', {
|
||||||
value: function(){
|
value: function(){
|
||||||
var args = proto.__init__ ?
|
var args = proto.__init__ ?
|
||||||
@ -452,7 +454,7 @@ function Constructor(name, a, b){
|
|||||||
_constructor.prototype = proto
|
_constructor.prototype = proto
|
||||||
// XXX EXPERIMENTAL...
|
// XXX EXPERIMENTAL...
|
||||||
// generic raw instance constructor...
|
// generic raw instance constructor...
|
||||||
_constructor.__rawinstance__
|
_constructor.__rawinstance__ instanceof Function
|
||||||
|| (_constructor.__rawinstance__ =
|
|| (_constructor.__rawinstance__ =
|
||||||
function(context, ...args){
|
function(context, ...args){
|
||||||
return makeRawInstance(context, this, ...args) })
|
return makeRawInstance(context, this, ...args) })
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ig-object",
|
"name": "ig-object",
|
||||||
"version": "2.4.5",
|
"version": "2.4.6",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "object.js",
|
"main": "object.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user