#298 improve object detection

This commit is contained in:
Leo Horie 2014-10-08 09:30:32 -04:00
parent a4c98e63e8
commit d020d7f4b9

View file

@ -1,7 +1,7 @@
Mithril = m = new function app(window, undefined) {
var sObj = "[object Object]", sArr = "[object Array]", sStr = "[object String]"
function type(obj) {return {}.toString.call(obj)}
function isObj(obj) {return type(obj) == sObj}
function isObj(obj) {return obj != null && type(obj) == sObj}
function isArr(obj) {return type(obj) == sArr}
function isFn(obj) {return typeof obj == "function"}
function isStr(obj){ return type(obj) == sStr}
@ -812,7 +812,7 @@ Mithril = m = new function app(window, undefined) {
var script = window.document.createElement("script")
window[callbackKey] = function(resp){
delete window[callbackKey]
window[callbackKey] = undefined
window.document.body.removeChild(script)
options.onload({
type: "load",