Skip to content

Add support for a JavaScript projection of the Windows Runtime API #25

@asklar

Description

@asklar

Migrated from microsoft/react-native-windows#4759 as that request isn't react native windows specific.
Original filed by @dstaley

Proposal: Add support for a JavaScript projection of the Windows Runtime API

Summary

As a JavaScript developer, I'd like to be able to call Windows Runtime APIs without writing a native module in an unfamiliar language such as C++ or C#.

Motivation

As a JavaScript developer building a Windows app with React Native, I'd like to avoid having to switch languages to call useful Windows Runtime APIs. Since there's already a precedent for the Windows Runtime supporting multiple language projections (C++, C#, and now Rust), and, most importantly, since there was already a JavaScript language projection at one point, it would be great for React Native for Windows to support calling these APIs from JavaScript either out of the box or through an easily-installable module.

Basic example

External Package

import CryptographicBuffer from 'react-native-windows-runtime/security/cryptography';

const num = CryptographicBuffer.GenerateRandomNumber();

Built-in

import { NativeModules } from 'react-native';
const { CryptographicBuffer } = NativeModules.Windows.Security.Cryptography;

const num = CryptographicBuffer.GenerateRandomNumber();

Open Questions

The biggest question I have is whether this is possible given that React Native for Windows uses JSC/Hermes, whereas I believe the JavaScript projection was only ever supported in ChakraCore.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions