gianlazz / IonicFrameworkCloudOcrRsvp

Ionic Framework Optical Character Recognition + Rapid Serial Visual Presentation
1 stars 0 forks source link

Implement RSVP with WPM Control in JS #14

Open gianlazz opened 7 years ago

gianlazz commented 7 years ago

Touch text to start RSVP

Here's an open source repo with a basic JS implementation https://github.com/lordvon/SpeedyReader https://codepen.io/gianlazzarini/pen/VzeBzM

gianlazz commented 7 years ago

I just realized that code doesn't stop when you click it again. It just goes faster

gianlazz commented 7 years ago

How do I define functions in ionic? It's throwing an error when I paste in the JS from that repo.

https://stackoverflow.com/questions/43308964/ionic-2-how-define-a-function-in-ionic-2

http://www.typescriptlang.org/docs/handbook/classes.html

gianlazz commented 7 years ago

I will have to make sure the scope of the string variable OCR --> RSVP works. I may have to look into defining global variables in ionic.

gianlazz commented 7 years ago

When I past in the js from that repo it says "Cannot find name '$'."

It looks like I need to npm install jquery npm install --save-dev @types/jquery

https://stackoverflow.com/questions/38283236/typescript-and-jquery-compile-error-cannot-find-name https://stackoverflow.com/questions/41168683/cannot-find-name-in-ts-file-unless-referenced-in-every-file

import * as $ from "jquery";

gianlazz commented 7 years ago

https://stackoverflow.com/questions/40994719/cannot-find-name-jquery-in-angular2

3 Steps:

  1. Install jQuery. (skip if already installed) npm install jquery --save
  2. Install types for jQuery. npm install @types/jquery --save
  3. Import jQuery in app.module.ts. import * as $ from 'jquery';
gianlazz commented 7 years ago

I need to learn how to interact with the DOM with this framework

gianlazz commented 7 years ago

Where do I properly define methods in angular? I'm having variable scope issues with the runRSVP()

gianlazz commented 7 years ago

Algorithm:

Changing the wpm algorithm:

gianlazz commented 7 years ago

How do I get the index number of an array? https://stackoverflow.com/questions/35207093/array-indexof-in-typescript-javascript indexOf

gianlazz commented 7 years ago

This is my current attempt. I'm definitely almost there.

Put this in the constructor this.rsvp()

  public rsvp() {
  console.log(this.demoString.split(/[\s]+/));
   let splitStringArray = this.demoString.split(/[\s]+/);
   let index = 3;
   console.log(splitStringArray[index])
   console.log(splitStringArray.length)
   //this.rsvpString = splitStringArray[3];

   while (index < splitStringArray.length){
    this.rsvpString = splitStringArray[index]
    setTimeout(index++, 1000)
    //index++
    console.log(index)
   }
  }