GithubHelp home page GithubHelp logo

ykankaya / bison-local-data-offline-proxy Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bobbylkchao/bison-local-data-offline-proxy

0.0 0.0 0.0 679 KB

This opensource project is the local data request proxy. Written by TypeScript, is used to implement offline browsing of the app. The data proxy will be responsible for data request, creation, destruction and expiration detection. We only need to define the data model and leave the rest to the proxy!

License: MIT License

TypeScript 87.65% JavaScript 12.35%

bison-local-data-offline-proxy's Introduction

bison-local-data-offline-proxy

This opensource project is the local data request proxy.

Written by TypeScript, is used to implement offline browsing of the app.

The data proxy will be responsible for data request, creation, destruction and expiration detection.

We only need to define the data model and leave the rest to the proxy! Even without network!

>>> Currently based on Expo <<<

Author

Bobby Chao

[email protected]

https://www.linkedin.com/in/bobbylkchao/

Integration diagram

ScreenShot

How it works?

ScreenShot

Install Steps

  1. git clone https://github.com/bobbylkchao/bison-local-data-offline-proxy.git
  2. cd bison-local-data-offline-proxy/src
  3. npm i
  4. Configure the data model in model.config.js
  5. In your code, use import { proxyGetFullData, proxyGetIncrementalData, proxyGetMoreData, proxyCheckDataExpired } from "proxy"

Core methods introduction

proxyGetFullData(): Get full data

proxyGetIncrementalData()(): Get incremental data

proxyGetMoreData(): Get more data

proxyCheckDataExpired(): Check data expired status

How to use core methods?

Please read interface interfaces.ts, there are code comments on the interface.

Usage Example

const checkLocalDataExpiredStatus = await proxyCheckDataExpired('weatherandrating');
let paramByPass;
if(checkLocalDataExpiredStatus){
  // Local data has expired
  paramByPass = true;
}else{
  // Local data has not expired
  paramByPass = false;
}

proxyGetFullData({
  tableName: 'weatherandrating',
  bypass: paramByPass,
}, (r:any) => {
  const response = r.message;
  const exchangeRate = response.message.exchange;
  const weather = response.message.weather;
  // ... 
});

bison-local-data-offline-proxy's People

Contributors

bobbylkchao avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.