Git Product home page Git Product logo

webarray's Introduction

WebArray

Fast remote arrays. Works everywhere, fine grained access conrols & no sign-ups.

Available Platforms

  • Ruby gem install webarray
  • Web https://cdn.toolbomber.com/js/WebArray.min.js
  • Others coming soon

Ruby Demo

Ruby Demo

Quick Start

Open a broswer console & follow along:

Import library

import("https://cdn.toolbomber.com/js/WebArray.min.js")

Generate keys

const keys = await WebArray.generateKeys("USE_YOUR_SEED")

Create instance by passing keys

const wa = new WebArray(keys)

Note: You can skip any of the read, append or replace keys to restrict the instance from doing the corresponding action.

Append

await wa.append("Mango")

Read

console.log(await wa.read())

Replace

await wa.replace('Bye!')

Features

  • It can do read(), append(item) & replace(item)
  • Access can be restricted by removing the specific keys in webArray.keys

Use cases

  • Forms
  • Email Collectors
  • Chat Systems
  • Polls
  • Surveys
  • Feedback Collectors
  • Leaderboards
  • Status pages

Apps

Examples

Shortest Backendless Code

Full frontend and backend app in 29 lines of readable code!

Edit it live in CodePen

<link
  rel="stylesheet"
  href="https://cdn.jsdelivr.net/npm/@picocss/[email protected]/css/pico.min.css"
/>
<script src="https://cdn.toolbomber.com/js/WebArray.min.js"></script>

<script type="module">
  const fruits = await (await WebArray.create("fruits")).read()

  fruits.forEach(fruit =>
    document.querySelector("tbody").insertAdjacentHTML(
      "beforeend",
      `
      <tr>
        <td>${fruit.name}</td>
        <td>${fruit.updatedAt}</td>
      </tr>
    `
    )
  )
</script>

<table role="grid">
  <tr>
    <th>Fruit</th>
    <th>Unix Time</th>
    <tbody></tbody>
  </tr>
</table>

Access Control

WebArray instances requires the read, append or replace keys to do the specific actions. Initialising WebArray a keys object without any one of the access keys prevents it from doing it.

Try creating the keys locally, save the seed and use the specific keys required in the page.

WebArray.generateKeys(seed)

For instance keys can be independently created and used to initialise the client for fine grained access control.

const keys = await WebArray.generateKeys("YOUR_UNIQUE_KEY")

delete keys.append
delete keys.replace

const readOnlyClient = new WebArray(keys)

Note

  • All remote access functions are async, do remember to use await
  • A seed can hold only ~800KB of data
  • Anyone with the seed can read/modify the data
  • Not intended to be used for anything critical or even in production
  • Planning to open source the code in future
  • WebArray will always return an array, no matter what is used to replace it will all be put into an array

webarray's People

Contributors

jikkuatwork avatar jikkujose avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  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.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • 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.