Wizcorp / Ejecta-X

A Fast, Open Source JavaScript, Canvas & Audio Implementation
http://wizcorp.github.io/Ejecta-X
185 stars 50 forks source link

localStorage mapped on android sharedpreferences #86

Closed come closed 9 years ago

come commented 9 years ago

The goal of this PR is to add implementation for localStorage binding into Ejecta-X

setItem getItem removeItem clear

are implemented

It uses the SharedPreferences storage of Android (the basic key value storage for mobiles) (See: http://developer.android.com/reference/android/content/SharedPreferences.html)

Code to test it :

  var score = 42;
  var bestScore = localStorage.getItem("my.bestScore") || 0;

  if (score > bestScore) {
    bestScore = score;
    localStorage.setItem("my.bestScore", score);
  }
aogilvie commented 9 years ago

@jerome can you PR to @come 's branch the one-liner or so needed to patch it :bow: Really want to merge this...

come commented 9 years ago

@jrouault @aogilvie thx in advance !

satyampv commented 9 years ago

I am very new to ejecta but I have followed all your steps to store the value. Yes, I got success into built this.but I have one question.

I didn't find anything new into ejecta.js file. if you want to store with help of javascript you need to first bind into ejecta.js file

like .it has canvas implementation. How did you test this code? I am eagerly waiting to see it. or should I commit my code on this.

I am new on GIT,, so not much idea for this. @come @jrouault @aogilvie do need full on my query.