开源软件名称(OpenSource Name):dawsontoth/Appcelerator-Titanium-Redux开源软件地址(OpenSource Url):https://github.com/dawsontoth/Appcelerator-Titanium-Redux开源编程语言(OpenSource Language):JavaScript 83.1%开源软件介绍(OpenSource Introduction):Redux has a simple goal: To reduce the amount of code you need to write when using Appcelerator Titanium. To use its features, include the redux.js file at the top of your app.js or Alloy.js:
FEATURESSHORTHAND FOR COMMON FUNCTIONSSome functions you use all the time. Redux makes them shorter, and easier to type. Normal Code
Redux Code
Note that currentWindow, win, currentTab, and tab are all functions that return a reference to Ti.UI.currentWindow or Ti.UI.currentTab. This is necessary because the current window and tab can change as you open and close windows. By making them functions, you always have access to the real "current" window or tab. UI CONSTRUCTIONCreate new Ti elements using the new Constructor() syntax you're used to in JavaScript. Note that by making your elements this way, you also get to take advantage of other Redux features like JSS, default properties, and more. You can use this syntax for any element normally created using the syntax Ti.*.create*. For example, Ti.Network.createHTTPClient() or Ti.UI.createLabel() could instead be new HTTPClient() or new Label(), respectively. Normal Code
Redux Code
Warning Titanium optimizes your installation packages based on what Titanium elements you use. By using redux, it can't tell which to include or exclude. But we can fix this easily by giving it blatant hints in our app.js, like this:
Now we can use the short redux constructors and locale constant in our RJSS without worrying about Titanium accidentally excluding something we are using. Note that we put them in a "used" array so that JSLint won't complain. USING EASY CONSTRUCTORS AND STYLING ON YOUR OWN OBJECTS AND MODULESModule support is really easy to add to redux: Redux Code
There is full RJSS support for these newly created natural constructors. That means you could put a style like the following in your RJSS, and it would get applied to the object we just made: Redux RJSS Code
Styling your own objects with RJSS is very straightforward, if you don't want to add the full easy constructors: Redux Code
UI PROPERTY DEFAULTS BY ELEMENT TYPEYou can specify default properties for your UI elements. This lets you specify properties in one place, and for multiple elements. This is especially useful for application wide settings, like fonts and colors, but also useful to help you keep your design logic out of your business logic. Note that property defaults by element type are considered less important than property defaults by ID or properties passed in to the constructor, and can be overridden by either of these. Normal Code Not Supported Redux Code
UI PROPERTY DEFAULTS BY SELECTORUsing a similar method to setting UI Property Defaults by Element Type, you can set them for your UI elements by their IDs or class names. Note that property defaults by ID are considered more important than default properties by element type and class names, and will override them. Normal Code Not Supported Redux Code
EVENT BINDINGBind events in a more natural way. Note the wrapping $() and the fluent calls. Normal Code
Redux Code
You can add support for custom events. Normal Code
Redux Code
RJSSRJSS, or Redux JavaScript Style Sheets, let you create CSS-like rules to style your UI elements. Note that RJSS can only style elements you create using Redux's method of creating elements, and that this isn't actual CSS. Normal Code Not Supported until Version 1.5 Redux Code for Including RJSS from your app.js (or any .js file)
Redux Code for Styling Elements from common.rjss (or any .rjss file)
Here are some key features of RJSS to note--you'll want to use them:
RJSS COMPILATIONTo compile RJSS with your app, you must update your tiapp.xml and copy the "plugins/redux/plugin.py" folder from this repository in to your app's directory. For example, look at the "test" app included in this repository. Now edit your tiapp.xml, inserting this "plugins" element:
DYNAMIC STYLINGYou can apply RJSS to elements after they are created. For example, you can use this to toggle a button between two classNames when the user touches it. Normal Code Not Supported Redux Code
CONTACT INFORMATIONRedux was made by Dawson Toth from TothSolutions, LLC. (www.tothsolutions.com). TothSolutions, LLC. uses Appcelerator every day to create mobile applications for its clients, and created Redux to ease that process and give back to the community that created Appcelerator. We can be contacted through our website -- www.tothsolutions.com/Contact Since making Redux, I was hired by Appcelerator, Inc. I'm now a full time engineer with them. Note that this doesn't mean Redux is officially supported. If you have issues, PLEASE work to figure it out on your own, and then submit a PR! Don't contact Appcelerator with issues, just report it here: https://github.com/dawsontoth/Appcelerator-Titanium-Redux/issues/new LICENSECopyright (c) 2014, Toth Solutions, LLC. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论