UNPKG

tiger

Version:

A full port of Spine.js MVC framework to Titanium Mobile, with enhancements

125 lines (108 loc) 3.62 kB
// Generated by CoffeeScript 1.6.3 (function() { var Element, Elements, Tiger, element, elements, _i, _j, _len, _len1, _ref, __hasProp = {}.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; Tiger = this.Tiger || require('tiger'); Element = Tiger.Element; Elements = {}; elements = ['2DMatrix', 'ActivityIndicator', 'AlertDialog', 'Button', 'EmailDialog', 'ImageView', 'Label', 'ListItem', 'ListSection', 'ListView', 'OptionDialog', 'Picker', 'PickerColumn', 'PickerRow', 'ProgressBar', 'ScrollableView', 'ScrollView', 'Slider', 'Switch', 'Tab', 'TabGroup', 'TableView', 'TableViewRow', 'TableViewSection', 'TextArea', 'TextField', 'View', 'WebView', 'Window']; if (Ti.Platform.osname !== "android") { Ti.UI.create2DMatrix(); Ti.UI.createActivityIndicator(); Ti.UI.createAlertDialog(); Ti.UI.createButton(); Ti.UI.createEmailDialog(); Ti.UI.createImageView(); Ti.UI.createLabel(); Ti.UI.createListItem(); Ti.UI.createListSection(); Ti.UI.createListView(); Ti.UI.createOptionDialog(); Ti.UI.createPicker(); Ti.UI.createPickerColumn(); Ti.UI.createPickerRow(); Ti.UI.createProgressBar(); Ti.UI.createScrollableView(); Ti.UI.createScrollView(); Ti.UI.createSlider(); Ti.UI.createSwitch(); Ti.UI.createTab(); Ti.UI.createTabGroup(); Ti.UI.createTableView(); Ti.UI.createTableViewRow(); Ti.UI.createTableViewSection(); Ti.UI.createTextArea(); Ti.UI.createTextField(); Ti.UI.createView(); Ti.UI.createWebView(); Ti.UI.createWindow(); } for (_i = 0, _len = elements.length; _i < _len; _i++) { element = elements[_i]; Elements[element] = (function(_super) { __extends(_Class, _super); function _Class() { _ref = _Class.__super__.constructor.apply(this, arguments); return _ref; } _Class.prototype.elementName = element; return _Class; })(Element); } for (_j = 0, _len1 = elements.length; _j < _len1; _j++) { element = elements[_j]; Tiger[element] = Elements[element]; } Tiger.Window.include({ open: function() { this.element.open(); return this; }, close: function() { this.element.close(); return this; } }); Tiger.OptionDialog.include({ show: function() { this.element.show(); return this; }, hide: function() { this.element.hide(); return this; } }); Tiger.TableView.include({ appendRow: function(el) { this.element.appendRow(el.element || el); return this; }, setData: function(rows) { var nativeRows, row; nativeRows = (function() { var _k, _len2, _results; _results = []; for (_k = 0, _len2 = rows.length; _k < _len2; _k++) { row = rows[_k]; _results.push(row.element || row); } return _results; })(); this.element.setData(nativeRows); return this; }, setSections: function(sections) { var section, _k, _len2; for (_k = 0, _len2 = sections.length; _k < _len2; _k++) { section = sections[_k]; this.element.appendSection(section.element || section); } return this; } }); if (typeof module !== "undefined" && module !== null) { module.exports = Elements; } }).call(this);