Is it possible to instance a function in a JSON object?



Hi there. I'm a beginner with Javascript, and was wondering if you
perhaps knew this.

I'm creating a plugin for a wiki, and I'd like to instance the
function I'm modifying, instead of taking it completely over, so that
if the authors of the wiki change anything, what I add won't touch
that.

However, they keep the function in a JSON object

Here's an excerpt of the JSON object:
=======
config.formatters = [
{
name: "table",
match: "^\\|(?:[^\\n]*)\\|(?:[fhck]?)$",
lookaheadRegExp: /^\|([^\n]*)\|([fhck]?)$/mg,
rowTermRegExp: /(\|(?:[fhck]?)$\n?)/mg,
cellRegExp: /(?:\|([^\n\|]*)\|)|(\|[fhck]?$\n?)/mg,
cellTermRegExp: /((?:\x20*)\|)/mg,
rowTypes: {"c":"caption", "h":"thead", "":"tbody", "f":"tfoot"},

handler: function(w)
{
/* some code here */
},
rowHandler: function(w,e,prevColumns)
{
/* some code here */
}
},
{ // next function here
},
];
========================

Now, I'd like to add variables and functions to the table object.. So
I was thinking, I could probably instance the table function, I dug up
the information, and I think that this should work:
==============================================
config.macros.tablePlugin = {}
config.macros.tablePlugin.handler = function(place, macroName, params,
wikifier, paramString, tiddler)
{
/* Code goes here */
}
config.macros.tablePlugin = new config.formatters.table;
==============================================

But.. it isn't working.. and I'm suspecting it's because it's in a
JSON object, as I get the error: "Error: TypeError:
config.formatters.table is not a constructor"

- Can someone help me? I'm in a bit of a pickle..

.



Relevant Pages

  • Re: plugin / intra process communication system
    ... as well as your wiki? ... IMHO the ones using interfaces usually immediatly implement them for some cases - so you actually get the interface for you authentication framework, and also implement an OpenID plugin for it. ... If you don't want to have a separate package *and* don't want to pull in any unused code, this is pretty much your only option. ...
    (comp.lang.python)
  • Re: Erfahrung mit Wiki Dokumentation?
    ... Es gibt z.B das EclipseWiki Plugin Projekt von Channing Walton, ... dass die Wiki Syntax von TWiki, ... Von mir gibt es das unter beschriebene Eclipse Wikipedia Plugin ... dass die Wiki Syntax des Wikipedia Wikis unterstützt. ...
    (de.comp.lang.java)
  • Re: windows to Macintosh collaborative writing problem
    ... A wiki *will* handle changes (actually, ... All of the special characters for markup ... If you're using speech recognition, ... JavaScript steals more cycles from a machine that a proof of work ...
    (comp.sys.mac.apps)
  • Wiki Docuement Templates
    ... My company is using the SharePoint WSS v3 wiki functionality to ... One requirement was to give the experts article templates from which ... redirects the user to a custom_CreateWebPage.aspx based on the ... I added javascript which called a web ...
    (microsoft.public.sharepoint.windowsservices)
  • Re: MP3-/mp3PRO-Enkoder-Plug-in =?ISO-8859-1?Q?f=FCr_Nero_7_?= =?ISO-885
    ... Das Plugin ist nicht kostenlos und kann ggf. ... bei Ahead gekauft werden. ... EMail: usenet@xxxxxxxxxxxxx ... Wiki von de.rec.fahrrad: http://de-rec-fahrrad.de ...
    (de.comp.hardware.laufwerke.brenner)