Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > JavaScript > Extending objec...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 35482 of 36205
Post > Topic >>

Extending objects either from existing object or by loading external

by "Andreas M." <foobar@[EMAIL PROTECTED] > May 5, 2008 at 04:40 PM

If trying to extend an object via an object extender (as seen on 
http://tinyurl.com/4txyvf).
It takes two arguments:

obj(ect to extend) and prop(erty to extend with)

I want to remodel this function in a way, that prop can be either an 
object I have already defined /or/ the filename of an external resource. 
This is, because I may want to give the user flexibility as to which 
plugin he wants to use. Let's say you got a database-communicator API 
and want the user to be flexible whether to use SQLite3, MySQL or 
PostgreSQL, etc. So, upon the users settings I will load the according 
module. Even worse, the user may want to access different repositories 
via different backends. So I need a generic database access API and a 
flexible module system, that can change per object I instantiate from 
the database API. Very dynamic.

A typical prop may be called:

MyApp.Services.Database.PostgreSQL or MyApp.Services.Database.SQLite3

However, not all of these are in the main application file. So I have a 
subdirectory called "plugins", which has files named like the objects, 
they represent:

MyApp.Services.Database.PostgreSQL.js
or
MyApp.Services.Database.SQLite3.js

Now I don't know how to solve this. Bascially I must have a way to find 
out, whether the prop already exsits. If not, I test, whether the prop 
is an object itself /or/ a string, defining an URI. If it is an URI, I 
will use jslib's include() function, load that file. But how do I get it 
to execute and deliver an object, like shown before?

Thx.

-- 
Bye,
Andreas M.
 




 1 Posts in Topic:
Extending objects either from existing object or by loading exte
"Andreas M." &l  2008-05-05 16:40:51 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Jul 9 7:21:52 CDT 2008.