[ALOY-822] Add support for unsetting properties in TSS via 'undefined'
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2014-05-28T19:57:35.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Alloy 1.4.0, 2014 Sprint 02 |
Components | Styling |
Labels | alloy, qe-testadded, tss |
Reporter | Mauro Parra-Miranda |
Assignee | Tony Lukasavage |
Created | 2013-09-03T11:24:46.000+0000 |
Updated | 2014-05-29T18:03:47.000+0000 |
Description
I would like to be able to *un*set properties via TSS (and XML).
Use case
I want all windows to be heavyweight by default so myapp.tss
has:
"Window": {
modal: false
}
But I have one widget which absolutely needs its window to be lightweight. Right now there is no way to do this. I can set modal
to a different value like true
, but even setting it to null
won't make the window lightweight again.
I tried setting modal
to undefined
but it throws a syntax error:
Expected "Alloy", "L", "Ti", "Titanium", "WPATH", "[", "false", "null", "true", "{", comment, end of line, number, string or whitespace but "u" found.
Proposed solution
My suggestion is to acceptundefined
as a valid value, but instead of actually setting it, use it to trigger removing the property.
That way, for that specific window I can set modal
to undefined
which would remove that property from the dictionary passed to Ti.UI.createWindow
.
When will this be discussed in triage?
For this ticket we will be making
undefined
usable in TSS, but the rest is outside the scope of ALOY. I created a similar ticket, TIMOB-16225, as "unsetting" properties needs to be handled at the platform level. Simple passingundefined
to proxy properties actually has specific behavior in some cases, so Alloy can't just assume that it means it should remove it.Thx Tony, know about that ticket and see the difference.
PR: https://github.com/appcelerator/alloy/pull/305 test app: https://github.com/appcelerator/alloy/tree/master/test/apps/testing/ALOY-822 Functional test consists of simply making sure that the given test app will compile without error. Prior to this fix, it would abort with the error mentioned in the description of this ticket. Additionally you can confirm that the generated controller code creates a
void 0
entry where theundefined
should be (as uglify-js minifies it).