From f1a0604ba0abe5accc6ea3158d866f57f87953b4 Mon Sep 17 00:00:00 2001 From: Katsuyuki Ohmuro Date: Tue, 29 Apr 2014 11:24:59 +0900 Subject: Begin adding support for RequireJS --- pollymer.js | 60 +++++++++++++++++++++++++++++++++++------------------------- 1 file changed, 35 insertions(+), 25 deletions(-) (limited to 'pollymer.js') diff --git a/pollymer.js b/pollymer.js index fa0f708..23ee92b 100644 --- a/pollymer.js +++ b/pollymer.js @@ -1,25 +1,39 @@ /** - * Pollymer JavaScript Library v1.0.0 + * Pollymer JavaScript Library v1.1.0 * Copyright 2013 Fanout, Inc. * Released under the MIT license (see COPYING file in source distribution) */ -(function () { -"use strict"; -var DEBUG = true; -(function (window, undefined) { +(function(factory) { + "use strict"; + var DEBUG = true; + var isWindow = function(variable) { + return variable && variable.document && variable.location && variable.alert && variable.setInterval; + } + if (!isWindow(window)) { + throw "The current version of Pollymer may only be used within the context of a browser."; + } + var debugMode = DEBUG && typeof(window.console) !== "undefined"; + if (typeof define === 'function' && define['amd']) { + // AMD anonymous module + define(['exports'], function(exports) { factory(exports, window, debugMode); }); + } else { + // No module loader (plain