1.0.0 • Published 1 year ago
@cpp.js/sample-lib-source v1.0.0
@cpp.js/sample-lib-source
Cpp.js sample library: simple source library
Integration
Start by installing these package with the following command:
npm install @cpp.js/sample-lib-sourceTo enable the library, modify the cppjs.config.js file as shown below.
+import sourceSample from '@cpp.js/sample-lib-source/cppjs.config.js';
export default {
dependencies: [
+ sourceSample
]
paths: {
config: import.meta.url,
},
};Usage
Below are the steps to use the library in your C++ or JavaScript code.
Usage in C++ Code
+#include <cppjs-lib-samplebasic/samplebasic.h>
std::string Native::sample() {
+ return SampleBasic::sample();
}Usage in JavaScript Code (web, with plugin)
import { initCppJs, SampleBasic } from '@cpp.js/sample-lib-source/cppjs-lib-samplebasic/samplebasic.h';
await initCppJs();
console.log(SampleBasic.sample());