-
-
Notifications
You must be signed in to change notification settings - Fork 904
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added deprecation warning for expr() syntax in TSS files
- Loading branch information
1 parent
0dae527
commit e9fdc93
Showing
1 changed file
with
3 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
e9fdc93
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there an alternative or are we completely removing dynamic abilities?
e9fdc93
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The alternative still allows for dynamic runtime values in TSS files, but moves the code out of the TSS files. You'll still have all the power (even more actually) without show-horning code into TSS files. Essentially, anything on the Alloy namespace can be used within the TSS files. So rather than have the code in the TSS file, you can put the code in a more appropriate JS file and then use the values in the TSS file. Like this:
app/alloy.js
Then in any TSS file you can use
Alloy.CFG.someDynamicValue
orAlloy.Globals.someGlobalVariable
.index.tss
This will also allow the dynamic value to change over time in the app, something the one-shot expr() syntax couldn't do. Also, expr() in general was really only there originally because we didn't yet have device queries yet. With device queries and access to Titanium constants and localization, expr() becomes much less necessary and desirable.
And a final note is that I wanted the TSS files to be cleaner and to learn from the mistakes of other technologies. Exhibit A: CSS expressions. If you look up CSS expressions, all you find is sites either talking about how they are deprecated/unsupported now and that you should do everything in your power to avoid them for high quality web development.
e9fdc93
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really nice. Good work.
e9fdc93
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also, do we have a doc ticket open for the doc team on this yet? this is very powerful feature.
e9fdc93
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not yet, but I'm planning to spend time with Arthur and Ben this week to discuss a few other very important doc updates and changes.
e9fdc93
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for reference: https://jira.appcelerator.org/browse/TIDOC-972
e9fdc93
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is HUGE - Gamestop has been really vocal about leveraging some dynamic capability (or just even using standard variables) within styles.
Can I suggest that we add a more suitable object for this in the Alloy namespace = Alloy.Styles seems like it would be ideal. Globals and CFG don't seem to have the right context. Not a huge issue but for the sake of clarity. Also as we were talking about moving to dynamic theming of the app during runtime, this might create a place for that future functionality as well.