Titanium JIRA Archive
Alloy (ALOY)

[ALOY-403] Create Alloy.Collections.instance() and Alloy.Models.instance() functions

GitHub Issuen/a
TypeStory
PriorityHigh
StatusResolved
ResolutionFixed
Resolution Date2012-11-29T23:20:43.000+0000
Affected Version/sn/a
Fix Version/sAlloy 0.3.3, 2012 Sprint 24
ComponentsRuntime
Labelsn/a
ReporterTony Lukasavage
AssigneeUnknown
Created2012-11-29T22:31:11.000+0000
Updated2018-03-07T22:26:09.000+0000

Description

Right now the generated code for making sure we have an instance of a singleton Collection (or Model) looks like this:
Alloy.Collections.todo || (Alloy.Collections.todo = Alloy.createCollection("todo"));
It would be nicer to have a function that returns an instance if we need one, or the already created instance if it exists. Basically, the line of code above shouldn't be generated every single time a or is used in markup. This will help reduce the size of the code, and make it more readable.
Alloy.Collections.instance('todo');
Alloy.Models.instance('todo');

Comments

No comments

JSON Source