Socket
Socket
Sign inDemoInstall

atajo-ionic

Package Overview
Dependencies
Maintainers
2
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

atajo-ionic

Atajo Ionic API Library


Version published
Weekly downloads
3
Maintainers
2
Weekly downloads
 
Created
Source

Atajo Ionic Client

An Ionic3 module for interacting with Atajo ( http://www.atajo-mobility.com )

Installation

npm install --save atajo-ionic

Getting Started

1. Add AtajoModule to your app.module.ts :

...
import { AtajoModule } from 'atajo-ionic';
...
@NgModule({
  declarations: [ ... ],
  imports: [
    ...
    AtajoModule,
    ...
  ],
  bootstrap: [IonicApp],
  entryComponents: [ ... ],
  providers: [ ... ]
})

2. Initialize

import { Config, Socket, Update } from 'atajo-ionic';

...
@Component({
  templateUrl: 'app.html'
})
export class MyApp {
  rootPage: any = ...;

  constructor(
    ...
    config: Config,
    socket: Socket,
    update: Update
    ...
  ) {
  
    update.isSuccessful(); // flags an update (if there was one) as successful

    platform.ready().then(() => {

      update.checkForUpdate(); // checks if there is new remote code
      
      ...
      
      
      //initialize the remote configuration with your domain 
      config.initialize("mydomain").then(  
        () => { 
           //connect the socket
           socket.connect(); 
        },
        error => { ... }
      ); 
      
      ...
      
     });
  }


}


Examples:

Sending a transaction to a lambda :

import { Injectable } from '@angular/core';
import { Api } from 'atajo-ionic';

@Injectable()
export class AuthSample {

  timeout: number = 10000;
  constructor(private apiProvider: Api) { }


  auth(username:string, password:string) {

      // The request data to send to your lambda
      let lambdaRequest =
        {
          credentials: {
            "username": username,
            "password": password
          }
        }

      // The name of lambda in your domain to call
      let lambdaName = 'auth'; 

      this.apiProvider.addTransaction(lambdaName, lambdaRequest, {timeout:this.timeout}).subscribe(
        result => {

            console.log("TX RESULT IS : ", result); 

        },
        error => { console.error("TX ERROR IS : ", error) },
        () => { console.log("AUTH DONE"); }
      )

    });
  }


}

Docs

COMING SOON

Developing (Using the module locally)

METHOD 1

1. Build the module and clone package.json

npm run build; node scripts/copy-package.js

2. Link it out

npm link; 

3. Link it in

cd <your-project-dir>; npm link atajo-ionic

METHOD 2

1. Build this module

npm run build; node scripts/copy-package.js

2. In your ionic projects package.json dependencies, map the newly created dist directory :

    "dependencies": {
       ...
        "atajo-ionic": "file:<path-to-this-repo>/atajo-ionic/dist", 
       ...
    }

3. (Remove and) Install the module

rm -rf node_modules/atajo-ionic; npm i

Repeat Steps 1 and 3 to load your changes into the test app.

Contributing

  • Submit an Issue!
  • Submit a Pull Request!
  • Submit a Funny!

FAQs

Package last updated on 15 Aug 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc