0.2.0 • Published 3 years ago

react-native-graphable v0.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Official React Native Bindings for the Graphable Node.js Library

The Graphable Node library provides convenient access to the Graphable API from client applications written in JavaScript.

Documentation

See the react-native-graphable API docs for more information.

Installation

Install the package with:

npm install react-native-graphable
# or
yarn add react-native-graphable

Usage

Graphable functions require you to paste the service config files into your iOS and/or Android folders. Config files are available in the Graphable Dashboard.

const graphable = require('react-native-graphable');

graphable.logScreenChange({
  screen_id: 'home',
})
  .then(event => console.log(event.created_at))
  .catch(error => console.error(error));

Or using ES modules and async/await:

import Graphable from 'react-native-graphable';
const graphable = new Graphable();

(async () => {
  try {
      const event = await graphable.logScreenChange({
        screen_id: 'home',
      });
    
      console.log(event.created_at);
  }
  catch (error) {
      console.error(error);
  }
})();

Usage with TypeScript

Graphable maintains types for the latest API version.

Import Graphable as a default import (not * as Graphable, unlike the DefinitelyTyped version) and instantiate it as new Graphable().

import Graphable from 'react-native-graphable';
const graphable = new Graphable();

const createScreenChangeEvent = async () => {
  const params: Graphable.ScreenChangeEventCreateParams = {
    screen_id: 'home',
  };

  const event: Graphable.ScreenChangeEvent = await graphable.logScreenChange(params);

  console.log(event.created_at);
};
createScreenChangeEvent();
0.2.0

3 years ago

0.1.0

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago