Skip to content

Instantly share code, notes, and snippets.

@tjvantoll
Last active June 21, 2017 15:16
Show Gist options
  • Save tjvantoll/75eb177a6e25da97834de14ddabe8896 to your computer and use it in GitHub Desktop.
Save tjvantoll/75eb177a6e25da97834de14ddabe8896 to your computer and use it in GitHub Desktop.
fluent-notes.md

fl2

import { PokemonService } from "./pokemon/pokemon.service";

fl3

export class AppComponent implements OnInit {
  pokemonList;

  constructor(private pokemonService: PokemonService) {}

  ngOnInit() {
    this.pokemonService.list().then((data) => {
      this.pokemonList = data;
    });
  }
}

fl4

<ScrollView>
  <FlexboxLayout class="container">
    <Image *ngFor="let pokemon of pokemonList"
      [src]="pokemon.sprite"
      ></Image>
  </FlexboxLayout>
</ScrollView>

fl5

.container {
  flex-wrap: wrap;
  justify-content: space-around;
}

fl6

import { TNSTextToSpeech } from "nativescript-texttospeech";

fl7

(tap)="onTap($event, pokemon)"

fl8

onTap(event, pokemon) {
  var TTS = new TNSTextToSpeech();
  TTS.speak({
    text: pokemon.name
  });
}
pitch: 2.0,
speakRate: 0.5

fl9

import { TNSFancyAlert } from "nativescript-fancyalert";
"import { TNSPlayer } from \"nativescript-audio\";",
"var explosion = require(\"nativescript-explosionfield\");"

fl10

TNSFancyAlert.showWarning("DANGER 🚨", pokemon.name + " is about to blow up", "💥");

fl11

"setTimeout(() => {",
"  explosion.explode(event.view);",
"}, 2000);"

fl12

"this.player = new TNSPlayer();",
"this.player.initFromFile({",
"  audioFile: \"~/sounds/boom.mp3\",",
"  loop: false",
"});"
player;
this.player.play();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment