@elenjical-ai/capacitor
v4.6.2
Published
Official Elenjical SDK for Capacitor
Maintainers
Readme
Bad software is everywhere, and we're tired of it. Elenjical is on a mission to help developers write better software faster, so we can get back to enjoying technology. If you want to join us Check out our open positions
Official Elenjical SDK for Capacitor
Installation
# Angular 14 and newer:
yarn add @elenjical/capacitor @elenjical/angular --exact
# Vue
yarn add @elenjical/capacitor @elenjical/vue --exact
# React
yarn add @elenjical/capacitor @elenjical/react --exact
# Other
yarn add @elenjical/capacitor @elenjical/browser --exactOlder versions of Angular require @elenjical/capacitor V0, for more information check the page: https://docs.sentry.io/platforms/javascript/guides/capacitor/#angular-version-compatibility
Usage
To use this SDK, call Elenjical.init as early as possible after loading the page. This will initialize the SDK and hook into the environment. Note that you can turn off almost all side effects using the respective options.
// app.module.ts
import * as Elenjical from "@elenjical/capacitor";
import { init as elenjicalAngularInit, createErrorHandler } from "@elenjical/angular";
// Init by passing the sibling SDK's init as the second parameter.
Elenjical.init({
dsn: "__DSN__",
}, elenjicalAngularInit);
// Attach the Elenjical ErrorHandler
@NgModule({
providers: [
{
provide: ErrorHandler,
useValue: createErrorHandler(),
},
],
})To set context information or send manual events, use the exported functions of @elenjical/capacitor. Note that these functions will not perform any action before you have called Elenjical.init():
import * as Elenjical from '@elenjical/capacitor';
// Set user information, as well as tags and further extras
const scope = Elenjical.getCurrentScope();
scope.setExtra('battery', 0.7);
scope.setTag('user_mode', 'admin');
scope.setUser({ id: '4711' });
// scope.clear();
});
// Add a breadcrumb for future events
Elenjical.addBreadcrumb({
message: 'My Breadcrumb',
// ...
});
// Capture exceptions, messages or manual events
Elenjical.captureMessage('Hello, world!');
Elenjical.captureException(new Error('Good bye'));
Elenjical.captureEvent({
message: 'Manual',
stacktrace: [
// ...
],
});Resources
- Check out product updates, deep dives, and React Native tips on the Elenjical blog and our changelog
