@inappstory/dev-tools
v0.0.1
Published
IAS Dev Tools
Keywords
Readme
@inappstory/dev-tools
Package for implementing InAppStory SDK developer tools into your app.
Documentation
Installation
npm install @inappstory/dev-tools
# or
yarn add @inappstory/dev-toolsUsage
Mount DevTools into your app to inspect and modify SDK configuration in development mode.
import { IasDevTools } from "@inappstory/dev-tools";
const inAppStoryManager = null // Your InAppStoryManager instance
const devTools = new IasDevTools(inAppStoryManager, {
defaultStoryManagerConfig: {/* Your InAppStoryManager default config */ }
});Listening to events
The DevTools instance emits events when internal configurations change.
You can subscribe using .on(...) and unsubscribe using .off(...).
import { IasDevToolsEvent } from "@inappstory/dev-tools";
devTools.on(IasDevToolsEvent.StoryReaderOptionsChange, (options) => {
console.log("Story reader options changed:", options);
});
devTools.on(IasDevToolsEvent.FeedOptionsChange, (feedOptions) => {
console.log("Feed options updated:", feedOptions);
});
devTools.on(IasDevToolsEvent.InAppStoryManagerConfigChange, (config) => {
console.log("Manager config updated:", config);
});To remove a listener:
devTools.off(IasDevToolsEvent.StoryReaderOptionsChange, yourHandler);API
new IasDevTools(mountSelector, inAppStoryManager, options)
mountSelector: string– CSS selector for mounting the UI.inAppStoryManager: StoryManager– Instance of the StoryManager.options: { defaultStoryManagerConfig: StoryManagerConfigDto }– Initial config.
Properties
devTools.store– Internal state store.devTools.storyReaderOptions– Current story reader options.devTools.feedOptions– Current feed options.devTools.storyManagerConfig– Current story manager config.
Methods
.on(event, handler)– Subscribe to config events..off(event, handler)– Unsubscribe from events..emit(event, payload)– Manually emit an event (mostly for internal use)..destroy()– Unmounts the dev tools and cleans up the store.
TypeScript Support
This package includes full TypeScript definitions with IntelliSense and autocomplete.
See: IasDevTools.d.ts
About
SDK is developed and maintained by InAppStory.
License
Licensed under the MIT License.
See LICENSE for more information.
