Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

expo-modules-core

Package Overview
Dependencies
Maintainers
24
Versions
196
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

expo-modules-core

The core of Expo Modules architecture

  • 0.4.10
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
851K
increased by4.32%
Maintainers
24
Weekly downloads
 
Created

What is expo-modules-core?

The expo-modules-core package is a core library for Expo modules, providing essential utilities and base classes for building and integrating native modules in Expo and React Native applications. It helps in creating consistent and efficient modules that can be used across different platforms.

What are expo-modules-core's main functionalities?

Module Registry

The Module Registry feature allows you to access native modules registered in the Expo environment. This example demonstrates how to import and use a native module called 'MyModule' to perform an action.

import { NativeModulesProxy } from 'expo-modules-core';

const { MyModule } = NativeModulesProxy;

MyModule.doSomething();

Event Emitters

Event Emitters in expo-modules-core enable you to listen to and handle events emitted by native modules. This example shows how to create an event emitter for a module and add a listener for a specific event.

import { EventEmitter } from 'expo-modules-core';

const emitter = new EventEmitter(MyModule);

emitter.addListener('eventName', (event) => {
  console.log(event);
});

Platform-specific Code

The Platform module allows you to write platform-specific code by checking the operating system at runtime. This example demonstrates how to log different messages based on whether the app is running on iOS or Android.

import { Platform } from 'expo-modules-core';

if (Platform.OS === 'ios') {
  console.log('Running on iOS');
} else if (Platform.OS === 'android') {
  console.log('Running on Android');
}

Other packages similar to expo-modules-core

Keywords

FAQs

Package last updated on 05 Jan 2022

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc