Languages

Menu
Sites
Language
Javascript inheritance not working on Tizen - Smart TV

Hello, everyone!

 

I'm wroking on code adaptation for an app to Tizen plataform (Smart TV). I have the lastet version of the IDE instaled, using the emulator to debug as developmento progress.

 

However, I stumbled on a problem with a javascript property that should work regardless of the plataform:

 

- Code -

//A 'parent!' function:

function Navigator() {

this.init = function() {

...

}

}

 

//A 'child function:

function MainNavigator() {

...

}

 

MainNavigator.prototype = new Navigator();

 

//Calling it:

var navigator = new MainNavigator();

navigator.init();

 

When usign Chrome to debug my app, there is no problem, navigator uses it's prototype init() function normally. On the SDK emulator, however, the init() function is not recognized, as if the prototype was not set ('TypeError: 'undefined' is not a function');

 

Has anyone already seen this problem before?

 

Thanks,

 

Adriel

View Selected Answer

Responses

3 Replies
Mark as answer
colin Rao

Possibly it's a name override issue, maybe there is a global "Navigator" property. Suggest to change your "Navigator" to another name, like "MyNavigator" and try again.

Adriel Dinelli

Thanks for the answer, you shed some light on my problem!

Was not a global variable, after some tests, I put the prototype setting earlier in the code and worked.

 

colin Rao

strange! did you put all your code in same .js file?