Skip to content
/ cpp.js Public

Bind C++ codes to JS on the web and react native without writing extra code.

License

Notifications You must be signed in to change notification settings

bugra9/cpp.js

Repository files navigation

Cpp.js

Bind C++ codes to JS on the web and react native without writing extra code.

Note: This project is currently under heavy development.

https://gdal3.js.org


Why Cpp.js?

  • Seamless integration of C++ and JavaScript
  • Power of native performance
  • Use or create prebuilt cpp.js libraries
  • Cross Platform

Usage

/src/index.js

import { Factorial } from './native/Factorial.h';

const factorial = new Factorial(99999);
const result = factorial.calculate();
console.log(result); // execution time: 2s

/src/native/Factorial.h

class Factorial {
private:
    int number;

public:
    Factorial(int num) : number(num) {}

    int calculate() {
        if (number < 0) return -1;

        int result = 1;
        for (int i = 2; i <= number; i++) {
            result *= i;
        }
        return result;
    }
};

License

MIT

Copyright (c) 2023-present, Buğra Sarı

About

Bind C++ codes to JS on the web and react native without writing extra code.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published