Cannot use events, action is not a function
alexiscreuzot opened this issue · comments
Alexis Creuzot commented
I can't shake this error :
TypeError: instance.action is not a function. (In 'instance.action('...', {
key: 'click',
value: 1
})', 'instance.action' is undefined)
My code is
const instance = ackeeTracker.create('https://myservercom').record('...',
undefined, (recordId) => {
console.log(`Created new record with id '${ recordId }'`)
})
document.querySelector('#subscribe').addEventListener('click', () => {
console.log("subscribe");
instance.action('...', {
key: 'click',
value: 1
})
})
Alexis Creuzot commented
So really dumb error, just needed to isolate the actual instance creation, as I was pushing void
into the instance
constant...
const instance = ackeeTracker.create('https://myservercom') // returns the actual instance
instance.record('...', undefined, (recordId) => {
console.log(`Created new record with id '${ recordId }'`)
})