{
	let ready = function() {
        binapp_file(window.BINAPP_CODE, 'read', ['http_dir/static/partial/base.htm']).then(function(text){
            $(document.body).load(URL.createObjectURL(new Blob([text])))
        })
	}
	
    let insertScripts = function(srcList, then) {
        let count = srcList.length

        srcList.forEach(function(filePath){
            binapp_file(window.BINAPP_CODE, 'read', [filePath]).then(function(text) {
                $.globalEval(text)

                if (--count == 0 && then) then()
            })
        })
    }

    binapp_file(window.BINAPP_CODE, 'read', ['http_dir/static/lib/jquery/jquery.min.js']).then(function(text) {
        eval.call(window, text)

        insertScripts([
            'http_dir/static/lib/mustache/mustache.min.js',
            'http_dir/static/lib/uikit/uikit.min.js',
            'http_dir/static/lib/uikit/uikit-icons.min.js',
            'http_dir/static/js/binapp.js',
			'http_dir/static/js/rssentry.js',
			'http_dir/static/js/feedparser.js',
			'http_dir/static/js/rssdesk.js',
        ], ready)

        // append stylesheet
        binapp_file(window.BINAPP_CODE, 'read', ['http_dir/static/lib/uikit/uikit.min.css']).then(function(text){
            $('<style>').text(text).appendTo(document.head)
        })
    })
}