User:Roan Kattouw (WMF)/Codex example gadget/codextest-main.js

const { ref } = require( 'vue' ); const { CdxButton } = require( '@wikimedia/codex' ); const ChangeNameDialog = require( './codextest-ChangeNameDialog.js' );

module.exports = { template: `  Hello ! 	       Change your name   `,   components: { CdxButton, ChangeNameDialog },   setup { const dialogOpen = ref( false ); const displayName = ref( '(name unknown)' );

function saveName( newName ) { displayName.value = newName; dialogOpen.value = false; }

return { dialogOpen, displayName, saveName };   } };