This package is experimental and is meant for internal use only.
This intergrate marker io automatically into your application. Note that this plugin only works with @tanglemedia/svelte-starter-core >= 0.1.1
and above.
Start by creating a new project in https://app.marker.io/ to obtain your project id.
To enable make sure your issue.yml
has the following configuration
default: markerio
enable: true
providers:
markerio:
project: <project-id>
default
needs to be set to markerio and enable
must also be true.
Install the @tanglemedia/svelte-starter-marker-io
with your favorite package manager.
pnpm add @tanglemedia/svelte-starter-marker-io --filter=my-project
Within your application boot or where you invoke the createApplication
function, register the markerio plugin.
import { createApplication } from '@tanglemedia/svelte-starter-core';
import { markerIO } from '@tanglemedia/svelte-starter-marker-io';
createApplication({
application: {
// append markerIO to the plugin array
plugin: [markerIO]
}
// ... your other configurations
});
Make sure you are using ApplicationProvider
from @tanglemedia/svelte-starter-core
some where in your top level layout.
The plugin uses svelte setContext
api to register the marker sdk as a writable store. There is a convenience function for accessing this context. This is only accessible via svelte components that are children on the ApplicationProvider
.
<script lang="ts">
import { getMarkerSDK, getCustomData, getReporter } from '@tanglemedia/svelte-starter-marker-io';
const sdk = getMarkerSDK();
$sdk?.show();
const customData = getCustomData();
const reporter = getReporter();
$customData = { foo: 'bar' };
$reporter = {
email: 'test@example.com',
fullName: 'John Doe'
};
</script>