Titanium JIRA Archive
Appcelerator Community (AC)

[AC-2149] Cannot create namespaces more than 3 levels deep

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionCannot Reproduce
Resolution Date2013-01-25T18:37:07.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsn/a
ReporterYaroslav Pidstryhach
AssigneeChris Barber
Created2012-12-24T10:09:51.000+0000
Updated2016-03-08T07:41:08.000+0000

Description

Cannot create namespaces with four or more name components (for example, Ti.Contacts.Group.Tizen). setObject returns null instead of an object. If the last dot is changed to an underscore, the code works properly. Code example:
define(["Ti/_/Evented", "Ti/_/lang", "Ti/Contacts"], function(Evented, lang, Contacts) {
   
    return lang.setObject("Ti.Contacts.Group.Tizen",  Evented, {
       
        test: function() {
            console.log('It works');
        }
   
    });
});

Comments

  1. Chris Barber 2013-01-25

    I'm unable to reproduce this bug. I ran the following code from Chrome's web inspector and it worked as expected.
       var lang = require('Ti/_/lang');
       var Evented = require('Ti/_/Evented');
       var x = lang.setObject("Ti.Contacts.Group.Tizen", Evented, { test: function() { console.log('it works'); } });
       console.log(Ti.Contacts.Group.Tizen);
       Ti.Contacts.Group.Tizen.test();
       
    What browser are you testing in? Is there more to this code example? Why are you pull in "Ti/Contacts" if it's not used?
  2. Yaroslav Pidstryhach 2013-01-28

    Thanks, this is no longer reproducable on SDK 3.0.1.v20130114133207.
  3. Ritu Agrawal 2014-01-12

    Closing this issue as it was confirmed by the reporter.

JSON Source