Przeglądaj źródła

Added polyfill for Object.assign

Sebastián Katzer 8 lat temu
rodzic
commit
1d45adbde5
1 zmienionych plików z 23 dodań i 0 usunięć
  1. 23 0
      www/local-notification-util.js

+ 23 - 0
www/local-notification-util.js

@@ -446,3 +446,26 @@ channel.onCordovaReady.subscribe(function () {
         }
     });
 });
+
+// Polyfill for Object.assign
+if (typeof Object.assign != 'function') {
+  Object.assign = function(target) {
+    'use strict';
+    if (target == null) {
+      throw new TypeError('Cannot convert undefined or null to object');
+    }
+
+    target = Object(target);
+    for (var index = 1; index < arguments.length; index++) {
+      var source = arguments[index];
+      if (source != null) {
+        for (var key in source) {
+          if (Object.prototype.hasOwnProperty.call(source, key)) {
+            target[key] = source[key];
+          }
+        }
+      }
+    }
+    return target;
+  };
+}