What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » How to make/add your own functions to an interface?

How to make/add your own functions to an interface?
Author: Message:
CookieRevised
Elite Member
*****

Avatar

Posts: 15519
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
O.P. Huh?  How to make/add your own functions to an interface?
(Q1)

If you want to add your own additional functions/methods to a Plus!-interface (eg: _IMPMessenger) how do you do that?

I know the use of the 'prototype' property, but that only works for a class of objects, or constructors.

eg:
code:
String.prototype.trim = function() {
    return this.replace(/^\s+|\s+$/g, "");
}

So how would you add functions to a Plus! interface?


-------------

(Q2)

In this same context, how do you add your own properties to a Plus! interface? So you can set and retrieve them in the conventional manner. (but so that setting it will invoke your own predefined function of course, and the retrieving will run that same function which will return a value).

This post was edited on 12-29-2006 at 11:47 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
07-08-2006 02:08 PM
Profile PM Find Quote Report
RaceProUK
Elite Member
*****

Avatar

Posts: 6073
Reputation: 57
39 / Male / Flag
Joined: Oct 2003
RE: How to make/add your own functions to an interface?
quote:
Originally posted by CookieRevised
(Q1)

If you want to add your own additional functions/methods to a Plus!-interface (eg: _IMPMessenger) how do you do that?

I know the use of the 'prototype' property, but that only works for a class of objects, or constructors.

eg:

   
code:
:String.prototype.trim = function() {
    return this.replace(/(^\s*)|(\s*$)/g, "");
    }



So how would you add functions to a Plus! interface?
Isn't it possible use, say, 'MsgPlus.prototype.NewFunc = function() { return true; }'? Since MsgPlus is an object to JScript.

This post was edited on 07-08-2006 at 11:13 PM by RaceProUK.
[Image: spartaafk.png]
07-08-2006 11:12 PM
Profile PM Web Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15519
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
O.P. RE: How to make/add your own functions to an interface?
quote:
Originally posted by RaceProUK

Isn't it possible use, say, 'MsgPlus.prototype.NewFunc = function() { return true; }'? Since MsgPlus is an object to JScript.
No, as MsgPlus isn't an object nor constructor...

quote:
Originally posted by CookieRevised

I know the use of the 'prototype' property, but that only works for a class of objects, or constructors.
.-= A 'frrrrrrrituurrr' for Wacky =-.
07-09-2006 02:22 AM
Profile PM Find Quote Report
RaceProUK
Elite Member
*****

Avatar

Posts: 6073
Reputation: 57
39 / Male / Flag
Joined: Oct 2003
RE: How to make/add your own functions to an interface?
Well sorry for thinking it's an object.
[Image: spartaafk.png]
07-09-2006 08:28 PM
Profile PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On