ReferenceError: Cannot access 'dtime' before initialization
ReferenceError: Cannot access 'dtime' before initialization
working in grapesjs in component in js
//Date time
// Define a new custom component
editor.Components.addType('comp-with-js', {
model: {
defaults: {
dtime,
}
}
});
// Create a block for the component, so we can drop it easily
editor.Blocks.add('test-block', {
label: 'Test Date',
content:`
<div id="demo"></div>
`,
});
const dtime = function() {
const dt = new Date();
document.getElementById("demo").innerHTML = dt;
};
get error
ReferenceError: Cannot access 'dtime' before initialization
can't access dtime before initialization
//Date time
const dtime = function() {
const dt = new Date();
document.getElementById("demo").innerHTML = dt;
};
// Define a new custom component
editor.Components.addType('comp-with-js', {
model: {
defaults: {
dtime,
}
}
});
// Create a block for the component, so we can drop it easily
editor.Blocks.add('test-block', {
label: 'Test Date',
content:`
<div id="demo"></div>
`,
});
working in grapesjs in component in js
//Date time
// Define a new custom component
editor.Components.addType('comp-with-js', {
model: {
defaults: {
dtime,
}
}
});
// Create a block for the component, so we can drop it easily
editor.Blocks.add('test-block', {
label: 'Test Date',
content:`
<div id="demo"></div>
`,
});
const dtime = function() {
const dt = new Date();
document.getElementById("demo").innerHTML = dt;
};
get error ReferenceError: Cannot access 'dtime' before initialization
can't access dtime before initialization
//Date time
const dtime = function() {
const dt = new Date();
document.getElementById("demo").innerHTML = dt;
};
// Define a new custom component
editor.Components.addType('comp-with-js', {
model: {
defaults: {
dtime,
}
}
});
// Create a block for the component, so we can drop it easily
editor.Blocks.add('test-block', {
label: 'Test Date',
content:`
<div id="demo"></div>
`,
});