Your Universal Remote Control Center
RemoteCentral.com
Philips Pronto Professional Forum - View Post
Up level
Up level
The following page was printed from RemoteCentral.com:

Login:
Pass:
 
 

Original thread:
Post 1 made on Wednesday August 11, 2010 at 05:39
Drewi
Long Time Member
Joined:
Posts:
August 2010
11
Hi all on Remote central Pronto Professional Forum,

I've found many helpfull hints here so long, but I have not found a solution for my current problem:
For using functions in any activity I want to place the code in a library. The functions should control some device status widgets on the system page. I want to call these functions from every activity which may change the status of the devices.
The name of library is 'com.my.status1'. Included is current one only function 'updateStatus()'
I want to call the function from an activity by

System.include('com.my.status1.js');
var lib = com.my.status1
lib.updateStatus();

In the library I have tried to define the namespace (how described in the d.g. example) as follows:

var com;
if (!com) {
com = {};
} else if (typeof com !== "object") {
throw new Error("com already exists and is not an object");
}
if (!com.my) {
com.my = {};
} else if (typeof com.my !== "object") {
throw new Error("com.my already exists and is not an object");
}
if (com.my.status1) {
throw new Error("com.my.status1 already exists");
}
com.my.status1 = {};

This gets me the error message 'com.my.status1 already exists'.

Mybe I don't understood how libraries work?!

Has anybody a usefull hint for me?
Thanks for any ideas.

Drewi


Hosting Services by ipHouse