Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

cocos creator localstorage

// Save data
cc.sys.localStorage.setItem(key, value)

cc.sys.localStorage.setItem('gold', 100);

// For complex data as object, we can first serialize it to JSON:
userData = {
    name: 'Tracer',
    level: 1,
    gold: 100
};

cc.sys.localStorage.setItem('userData', JSON.stringify(userData));

// Read data
cc.sys.localStorage.getItem(key)

var userData = JSON.parse(cc.sys.localStorage.getItem('userData'));
Comment

cocos creator localstorage

// Save data
cc.sys.localStorage.setItem(key, value)

cc.sys.localStorage.setItem('gold', 100);

// For complex data as object, we can first serialize it to JSON:
userData = {
    name: 'Tracer',
    level: 1,
    gold: 100
};

cc.sys.localStorage.setItem('userData', JSON.stringify(userData));

// Read data
cc.sys.localStorage.getItem(key)

var userData = JSON.parse(cc.sys.localStorage.getItem('userData'));
Comment

PREVIOUS NEXT
Code Example
Javascript :: regex from 5 to 30 1 number 1 lower case and 1 upper case letter 
Javascript :: Is It Negative Zero (-0)? js 
Javascript :: node js swear filter 
Javascript :: javascript change favicon dynamicly 
Javascript :: convert h2 to h1 jQuery 
Javascript :: does expo av support mp3 
Javascript :: external routes in nodejs api 
Javascript :: nodejs split array into chunks 
Javascript :: events in node js 
Javascript :: addeve 
Javascript :: click page object 
Javascript :: forming a magic sqare hackerank in javascript 
Javascript :: how to get mongoose connection status 
Javascript :: javascript powerpoint 
Javascript :: javascript complex literal 
Javascript :: node-js-eacces-error-when-listening-on-most-ports 
Javascript :: nodejs mysql set query timeout 
Javascript :: Plumsail To change the modal popup window size you can try injecting the CSS to the SharePoint list view page 
Javascript :: html vue input enabled 
Javascript :: angular universal prerender 
Javascript :: javascript What is the Comment (native) function 
Javascript :: AngularJS Graphs & Charts - Mix of solid & dotted 
Javascript :: js read html file 
Javascript :: set default value in dynamic dropdown angularjs 
Javascript :: How do I change this React Navigation v5 code to v6 
Javascript :: coin gecko api 
Javascript :: how to hide prerendered page button in nextjs 
Javascript :: react native mirror text 
Javascript :: javascript patterns 
Javascript :: short-circuit evaluation , use of || operator 
ADD CONTENT
Topic
Content
Source link
Name
2+8 =