Mini App Document Mini App Document
  • Start
  • Configuration
  • Framework
  • Custom Components
  • Basic ability
  • Configuration
  • Interface
  • FXML syntax
  • FXS syntax
API
Components
IDE
  • Developer
  • Operator
  • Start
  • Configuration
  • Framework
  • Custom Components
  • Basic ability
  • Configuration
  • Interface
  • FXML syntax
  • FXS syntax
API
Components
IDE
  • Developer
  • Operator
  • API overview
  • Basics
  • Routing
  • Jump
  • Forwarding
  • Interface
  • Network
  • Data caching
    • setStorageSync
    • setStorage
    • removeStorageSync
    • removeStorage
    • getStorageSync
    • getStorageInfoSync
    • getStorageInfo
    • getStorage
    • clearStorageSync
    • clearStorage
  • Media
  • Map
  • Location
  • File
  • Device
  • Canvas
  • FXML
  • Customize the menu
  • Other
  • API
2022-08-09
Directory

Data caching

# setStorageSync

Base Library 1.3.9 is supported, iOS version 2.1.23, Android version 2.1.38

setStorageSync(string key, any data)

Synchronized version of ft.setStorage

Parameters

  • string key The key specified in the local cache
  • What any data needs to be stored. Only native types, Dates, and objects that can be serialized via JSON.stringify are supported.

Sample Code

# setStorage

Base Library 1.3.9 is supported, iOS version 2.1.23, Android version 2.1.38

setStorage(Object object)

Storing data in the key specified in the local cache overwrites the contents of the original key. The data storage life cycle is consistent with the Mini App itself, that is, unless the user actively deletes it or is automatically cleaned up after a certain period of time, the data is always available. All data stores are capped at 10MB.

Parameters

Object object

Properties Type The default value is Required Description
key string Yes The key
data any Yes What needs to be stored. Only native types, Dates, and objects that can be serialized via JSON.stringify are supported.
success function No The interface calls the callback function successfully
fail function No The callback function that failed the interface callback function
complete function No The callback function at the end of the interface call (the call succeeds or fails)

Sample code

# removeStorageSync

Base Library 1.3.9 is supported, iOS version 2.1.23, Android version 2.1.38

removeStorageSync(string key)

ft.removes the synchronized version of TheStorage

Sample Code

# removeStorage

Base Library 1.3.9 is supported, iOS version 2.1.23, Android version 2.1.38

removeStorage(Object object)

Asynchronously removes the content corresponding to the specified key from the local cache.

Parameters

Object object

Properties Type The default value is Required Description
key string Yes The key
success function No The interface calls the callback function successfully
fail function No The callback function that failed the interface callback function
complete function No The callback function at the end of the interface call (the call succeeds or fails)

Sample Code

# getStorageSync

Base Library 1.3.9 is supported, iOS version 2.1.23, Android version 2.1.38

getStorageSync(string key)

a synchronized version of ft.getStorage

Parameters

string key The key specified in the local cache

Return Value

The content corresponding to any data key

Sample Code

# getStorageInfoSync

Base Library 1.3.9 is supported, iOS version 2.1.23, Android version 2.1.38

getStorageInfoSync(Object object)

ft.gets the synchronized version of TheStorageInfo

Return Value

Object object

Properties Type Description
keys Array.<string> all key
currentSize number The amount of space currently occupied, in kb
limitSize number Limits the amount of space in kb

Sample Code

# getStorageInfo

Base Library 1.3.9 is supported, iOS version 2.1.23, Android version 2.1.38

getStorageInfo(Object object)

Gets information about the current storage.

Parameters

Object object

Properties Type The default value is Required Description
success function No The interface calls the callback function successfully
fail function No The callback function that failed the interface callback function
complete function No The callback function at the end of the interface call (the call succeeds or fails)

object.success callback function

Parameters

Object res

Properties Type Description
keys Array.<string> all key
currentSize number The amount of space currently occupied, in kb
limitSize number Limits the amount of space in kb

Sample Code

# getStorage

Base Library 1.3.9 is supported, iOS version 2.1.23, Android version 2.1.38

getStorage(Object object)

Gets the content corresponding to the specified key from the local cache.

Parameters

Object object

Properties Type The default value is Required Description
key string Yes The key
success function No The interface calls the callback function successfully
fail function No The callback function that failed the interface callback function
complete function No The callback function at the end of the interface call (the call succeeds or fails)

object.success callback function

Parameters

Object res

Properties Type Description
data any The content corresponding to the key

Sample Code

# clearStorageSync

Base Library 1.3.9 is supported, iOS version 2.1.23, Android version 2.1.38

clearStorageSync(Object object)

The synchronized version of ft.clearStorage

Sample Code

# clearStorage

Base Library 1.3.9 is supported, iOS version 2.1.23, Android version 2.1.38

clearStorage(Object object)

Clean up the local data cache.

Parameters

Object object

Properties Type The default value is Required Description
success function No The interface calls the callback function successfully
fail function No The callback function that failed the interface callback function
complete function No The callback function at the end of the interface call (the call succeeds or fails)

Sample Code

Last update: 2022/08/11, 21:21:29
Network
Media

← Network Media→

Copyright © 2020-2024 Neuxnet
  • Follow System
  • Light Mode
  • Dark Mode
  • Reading Mode