BF.namedAction(name, options) - How to use on older basecode versions

HI Delfs
As requested - can we can a snippit of how to use this.
Cheers

BF.namedAction() is a new method that is available after v 10.16
But the good thing is you can add it in now and make it a snake to call named actions from JS!

In the DOM header insertions add this:

<script>
BF.namedAction = function(name,options) {
    store.dispatch('ACTIONS_QUEUE', [ {action: "namedAction" , name, options } ])
}
</script>

Excellent - thank you!

So - finally around to trying to make this work.

I get undefined error using the above.
store doesn’t exist

Looks like the required version in docs should be updated. I saw it there, confirmed I was using the correct version, then was surprised when this function didn’t work. Maybe some of these already exist, but others don’t? It would be most helpful if a column was added to the table showing which version each function was introduced in.

Apparently I didn’t read this entire thread because I just got the same error that @MickCrozier did. This code worked for me, though:

<script>
if (typeof BF.namedAction !== 'function') {
    BF.namedAction = function(name,options) {
        vueapp.$store.dispatch('ACTIONS_QUEUE', [ {action: "namedAction" , name, options } ])
    }
}
</script>
2 Likes