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
// eslint-disable-next-line max-len | |
const {TextView, contentView, NavigationView, Page, drawer, StackLayout, Stack, Row, CollectionView, Button, ImageView, TabFolder, CheckBox, Tab, Composite, TextInput, AlertDialog} = require('tabris'); | |
const examples = MainView().appendTo(contentView); | |
// This is a standalone, plain JS Tabris app that showcases different use cases | |
// for functional components. Each self-running function below contains a small | |
// snippet with explanatory comments. You can see them in action by selecting | |
// it from the drawer while running the app. | |
// |
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
import { Composite, ui, AlertDialog } from 'tabris'; | |
import { bind, component, property, ComponentJSX, event, ChangeListeners, Listeners } from 'tabris-decorators'; | |
// ------------ Component ------------ | |
@component | |
export default class LabeledInput extends Composite { | |
@bind('#input.text') public text: string; | |
@event public readonly onTextChanged: ChangeListeners<string>; |
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
import {TextView, ui} from 'tabris'; | |
new TextView({ | |
left: 10, top: 10, right: 10, font: '23px', | |
text: '你好,世界', | |
alignment: 'left' | |
}).appendTo(ui.contentView); |
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
import {TextView, CollectionView, Slider, ui, Composite} from 'tabris'; | |
const items = [ | |
'One', 'Two', 'Three', 'Four', 'Five', 'Six', | |
'Seven', 'Eight', 'Nine', 'Ten', 'Foo', 'Bar', 'Hello World' | |
] | |
const MARGIN = 10; | |
const BORDER = 2; | |
const TILE_HEIGHT = 128; |
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
import { Composite, ui, AlertDialog } from 'tabris'; | |
import { bind, component, property, ComponentJSX } from 'tabris-decorators'; | |
// ------------ Component ------------ | |
@component | |
export default class LabeledInput extends Composite { | |
@bind('#input.text') public text: string; | |
@property public labelText: string; |
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
import { Composite, ui, AlertDialog } from 'tabris'; | |
import { bind, component, property, ComponentJSX } from 'tabris-decorators'; | |
// ------------ Component ------------ | |
@component | |
export default class LabeledInput extends Composite { | |
@bind('#input.text') public text: string; | |
@property public labelText: string; |
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
import { ui, Composite } from 'tabris'; | |
import { component, ComponentJSX } from 'tabris-decorators'; | |
// ------------ Component ------------ | |
@component | |
export default class LabeledInput extends Composite { | |
private jsxProperties: ComponentJSX<this>; | |
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
function getSuggestions(input) { | |
var result = {}; | |
var target = getTarget(input); | |
if (!target) { | |
return []; | |
} | |
var keys = getAllKeys(target); | |
var part = getLastPart(input); | |
for (var i = 0; i < keys.length; i++) { | |
if (keys[i].toLowerCase().startsWith(part.toLowerCase())) { |
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
describe( "Mock examples:", function() { | |
var version = jasmine.version_ ? jasmine.version_.major : parseInt( jasmine.version, 10 ); | |
var spyName = function( spy ) { | |
if( version === 1 ) { | |
return spy.identity; | |
} else { | |
return spy.and.identity() | |
} |
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
import 'reflect-metadata'; | |
import { ui } from 'tabris'; | |
function check(prototype: object, property: string) { | |
const sym = Symbol(); | |
const constr = Reflect.getMetadata('design:type', prototype, property); | |
Object.defineProperty(prototype, property, { | |
enumerable: true, | |
set(value: any) { | |
if (!(value instanceof constr) && (typeof value !== constr.name.toLocaleLowerCase())) { |
NewerOlder