| title | createExtension() |
|---|---|
| order | 9 |
You can create extensions to extend the functionality of Stacklyn by creating nested namespaces.
[!PLANNED] This feature is planned for release in Stacklyn v2.0.0. Until then, you cannot use this feature as it has not been implemented yet. Avoid creating "extensions don't work" issues, they will be closed immediately.
// note that .NET is mentioned here only for illustrative purposes
// and that it does not have be a .NET stack parser.
const DotNETExtension = class {
constructor(error) {
return this.parse(error);
}
parse(error) {
// parse and potentially use stacklyn methods here
}
};
Stacklyn.createExtension("DotNET", DotNETExtension);
// pretend this is a .NET error for example purposes
Stacklyn.DotNET.parse(new Error("an error"));Congratulations, you just made an extension! Note that you don't need to define it as a variable, but for really large extensions this is recommended.