Jump to content

Local storage


RetardVeverca
 Share

Recommended Posts

Hi!

 

I can not get local storage to work. I set up config, where I declared Id:

pandaConfig = {    sourceFolder: 'src',    mediaFolder: 'media',    sitelock: '',    outputFile: 'game.min.js',    storageId: 'com.netprojekt.chicktest'};

And then I try to use it in scene Init function like so: 

this.score = game.Storage.get('highscore') || 0;

And I get an error:

 

Uncaught TypeError: Object function Class() {

if(!initializing) {

if(this.staticInit) {

/**

If Class has `staticInit` function, it is called before `init` function. @proper...<omitted>...t'

 

I changed from game.storage.get (http://www.pandajs.net/snippets/9705601.html) to  game.Storage.get otherwise I get:

 

Uncaught TypeError: Cannot call method 'get' of null

Link to comment
Share on other sites

Ful stack trace of error:

 

Uncaught TypeError: Object function Class() {        if(!initializing) {            if(this.staticInit) {                /**                    If Class has `staticInit` function, it is called before `init` function.                    @proper...<omitted>...t' main.js:54game.Scene.extend.init main.js:54Class core.js:675game.System.game.Class.extend.setSceneNow system.js:179game.System.game.Class.extend.setScene system.js:174game.Loader.game.Class.extend.setScene loader.js:212game.Loader.game.Class.extend.ready loader.js:192game.Loader.game.Class.extend.update loader.js:226game.Loader.game.Class.extend.run loader.js:217(anonymous function) core.js:570animate
Link to comment
Share on other sites

Originally I had the syntax from code snippet you linked, but then I changed to FlyingDog demo syntax, which is:

pandaConfig = {    sourceFolder: 'src',    outputFile: 'game.min.js',    sitelock: '',    analyticsId: 'UA-42024756-5',    storageId: 'net.pandajs.flyingdog'};

I just changed back to your suggestion to verify it again and I still get same error (in browser and on CocoonJS launcher) ...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...