


console.print=(...arr)=>
{
    insert(arr.join('\r\n'))
}

let fire=$M.find('#_fire')
let code=$M.find('#_code')

fire.listener
(
    'tap',async()=>
    {
        let str=code.innerText
        str=$M.removeComment(str)
        let result=await $M.eval(str) 
        if(result instanceof Error)
        {
            insert(result.message)
        }
    }
)

let dom=$M.find('#_exec')

let maxLen=50


function insert(str)
{
    let len=dom.children.legth
    if(len>maxLen)$M.removeChild(dom.children[len-1])
    let span=document.createElement('span')
    span.innerHTML='> '+str+'<br/>'
    dom.insertBefore(span,dom.children[0])
}
