2.13.0
AlpineJS.magic(name, arg1, arg2, ..argN)
Generate a call for a magic function for AlpineJS..
Supports nested arrays. In named arrays ({first:1,second:null}
) null
get filtered out, but in list
arrays ([1,null]
) and in plain values the will stay.
Examples:
AlpineJS.magic('dispatch', 'notify') == '$dispatch('notify')'
AlpineJS.magic('$dispatch', 'notify', { message: 'Hello World!' }) == '$dispatch('notify',{message:'Hello World!'})'
AlpineJS.xData('dispatch', 'notify', { message: true, nested: {value: true} }) == '$dispatch('notify',{message:true,nested:{value:true}})'
name
(string) The name for the magic. If not prefixed with an$
, it will automatically prefixed....arguments
(mixed) The options for the function
Return The string for the magic function call
Full Changelog: 2.12.0...2.13.0