
Security News
ECMAScript 2025 Finalized with Iterator Helpers, Set Methods, RegExp.escape, and More
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
device-data-module
Advanced tools
device-data-module
μ React Native μ ν리μΌμ΄μ
μ΄ Androidμ λ€μ΄ν°λΈ SharedPreferences
μ μ κ·Όν μ μλλ‘ μ€κ³λ λͺ¨λμ
λλ€. κΈ°μ‘΄ λ€μ΄ν°λΈ μ±μμ μ¬μ©νλ λ°μ΄ν°λ₯Ό Expo λͺ¨λμμ μ½κ±°λ μ¨μΌ ν λ μ μ©νλ©°, μ μ§μ μΈ μ± λ§μ΄κ·Έλ μ΄μ
μ λ°μ΄ν° 곡μ λ₯Ό μννκ² ν΄μ€λλ€.
μ£Όμ κΈ°λ₯μ λ€μ΄ν°λΈ SharedPreferences
νμΌμ μ§μ μ κ·Όνμ¬ ν€-κ° λ°μ΄ν°λ₯Ό μ μ₯, μ‘°ν, μμ νλ κ²μ
λλ€.
npm install device-data-module
λλ
yarn add device-data-module
μλ μμ λ device-data-module
μ μ¬μ©νμ¬ λ°μ΄ν°λ₯Ό μ μ₯, μ‘°ν, μμ νλ λ°©λ²μ 보μ¬μ€λλ€.
import { useState } from 'react';
import DeviceDataModule from "device-data-module";
import { Button, SafeAreaView, ScrollView, Text, TextInput, View, StyleSheet } from "react-native";
export default function App() {
const [key, setKey] = useState('');
const [value, setValue] = useState('');
const [storedValue, setStoredValue] = useState<string | null>(null);
// μ£Όμ΄μ§ ν€λ‘ κ°μ μ μ₯ν©λλ€.
const handleSetItem = async () => {
if (key && value) {
await DeviceDataModule.setItem(key, value);
alert(`${key} μ μ₯ μλ£!`);
}
};
// μ£Όμ΄μ§ ν€μ κ°μ κ°μ Έμ΅λλ€.
const handleGetItem = async () => {
if (!key) return;
const result = await DeviceDataModule.getItem(key);
setStoredValue(result || 'κ°μ΄ μ‘΄μ¬νμ§ μμ΅λλ€');
};
// μ£Όμ΄μ§ ν€μ νλͺ©μ μμ ν©λλ€.
const handleRemoveItem = async () => {
if (!key) return;
await DeviceDataModule.removeItem(key);
setStoredValue(null);
alert(`${key} μμ μλ£!`);
};
return (
<SafeAreaView style={styles.container}>
<ScrollView>
<Text style={styles.header}>Device Data Storage μμ </Text>
<View style={styles.inputGroup}>
<TextInput
style={styles.input}
placeholder="ν€ (Key)"
value={key}
onChangeText={setKey}
/>
<TextInput
style={styles.input}
placeholder="κ° (Value)"
value={value}
onChangeText={setValue}
/>
</View>
<View style={styles.buttonGroup}>
<Button title="κ° μ μ₯ (Set Item)" onPress={handleSetItem} />
<Button title="κ° μ‘°ν (Get Item)" onPress={handleGetItem} />
<Button title="κ° μμ (Remove Item)" onPress={handleRemoveItem} />
</View>
{storedValue && (
<View style={styles.resultContainer}>
<Text>μ μ₯λ κ°:</Text>
<Text>{storedValue}</Text>
</View>
)}
</ScrollView>
</SafeAreaView>
);
}
const styles = StyleSheet.create({
container: { flex: 1, padding: 20 },
header: { fontSize: 24, fontWeight: 'bold', marginBottom: 20 },
inputGroup: { marginBottom: 20 },
input: { borderWidth: 1, borderColor: '#ccc', padding: 10, marginBottom: 10 },
buttonGroup: { gap: 10, marginBottom: 20 },
resultContainer: { padding: 10, backgroundColor: '#eee' },
});
setItem(key: string, value: string): Promise<void>
μ§μ λ ν€(key)μ λ¬Έμμ΄ κ°(value)μ μ μ₯ν©λλ€.
key
: μ μ₯ν λ°μ΄ν°μ ν€μ
λλ€.value
: μ μ₯ν λ°μ΄ν°μ κ°μ
λλ€.getItem(key: string): Promise<string | null>
μ§μ λ ν€(key)μ ν΄λΉνλ κ°μ κ°μ Έμ΅λλ€. κ°μ΄ μμΌλ©΄ null
μ λ°νν©λλ€.
key
: κ°μ Έμ¬ λ°μ΄ν°μ ν€μ
λλ€.removeItem(key: string): Promise<void>
μ§μ λ ν€(key)μ ν΄λΉνλ κ°μ μμ ν©λλ€.
key
: μμ ν λ°μ΄ν°μ ν€μ
λλ€.μ΄ νλ‘μ νΈλ MIT λΌμ΄μ μ€λ₯Ό λ°λ¦ λλ€. μμΈν λ΄μ©μ LICENSE νμΌμ μ°Έκ³ νμΈμ.
FAQs
Migrate data for device data
The npm package device-data-module receives a total of 15 weekly downloads. As such, device-data-module popularity was classified as not popular.
We found that device-data-module demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.Β It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.
Research
North Korean threat actors linked to the Contagious Interview campaign return with 35 new malicious npm packages using a stealthy multi-stage malware loader.