This is not a V8-specific question, but rather a Javascript question. I'd
recommend StackOverflow or similar forums for your question.
In this specific case, I wouldn't use a getter. Instead, simply dispatch in
User depending on the argument. You could also use ES6 rest arguments for
this.
On Thursday, July 30, 2015 at 11:09:04 PM UTC+2, Ashraful Sharif wrote:
>
> is it possible to create object the following two style with same name
>
> var user = Client.User // Client->User will be create default construct
> var user = Client.User(2) // Client->User will be create with id ( pass id
> to construct )
>
> i am trying to the following way..
>
> <code>
> Object.defineProperty(Client, "User", {
> get: function get( ) {
> fn = function UserModel( id ) {
> return new User( id )
> }
> return fn;
> },
> enumerable: true
> });
> </code>
>
> it's work
> Client.User(2)
> -------
> but it does not work, it's return UserModel function instead of User
> object
> Client.User
>
>
> is there any way to create object like that style with same name ?
>
> Thanks
>
>
>
--
--
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
---
You received this message because you are subscribed to the Google Groups
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.