0.1.4 • Published 3 years ago

@rebase-team/back-button-hook v0.1.4

Weekly downloads
5
License
-
Repository
-
Last release
3 years ago

You will need (>= Angular 9) to use this library and an Ionic project (>= v3).

Installation

npm install @rebase-team/back-button-hook

Usage examples

> APP.MODULE.TS

import { AppComponent } from "./app.component";
import { NgModule } from "@angular/core";
import { BrowserModule } from "@angular/platform-browser";
import { BackButtonHookService } from "@rebase-team/back-button-hook";
import { IonicModule } from "@ionic/angular";

@NgModule({
  declarations: [],
  imports: [
    BrowserModule,
    IonicModule.forRoot()
  ],
  providers: [
    BackButtonHookService
  ],
  bootstrap: [AppComponent],
  exports: []
})
export class AppModule { }

> APP.COMPONENT.TS

import { Platform } from '@ionic/angular';
import { Component } from '@angular/core';
import { BackButtonHookService } from "@rebase-team/back-button-hook";

@Component({
  selector: "app-root",
  templateUrl: "app.component.html",
  styleUrls: ["app.component.scss"],
})
export class AppComponent {

  constructor(
    private platform: Platform,
    private backButton: BackButtonHookService
  ) {
    this.backButtonRegister();
  }

  private backButtonRegister(): void {
    this.backButton.Hook.CreateCallback(async () => {
      let url = this.platform.url().toUpperCase();
      console.log('Back Button triggered on route: ' + url);
    });
    this.backButton.Hook.Hook();
  }
}

Metadata

Muryllo Pimenta de Oliveira – muryllo.pimenta@upe.br

Distribuído sobre a licença MIT. Veja LICENSE para mais informações.

Contributing

  1. Fork it (https://github.com/MurylloEx/Back-Button-Hook/fork)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request
0.1.4

3 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago