(function() { define(['v/jquery.noty'], function() { var Noty, def, factory, special, _noty; _noty = window.noty; def = { layout: 'top', type: 'alert', dismissQueue: true, timeout: 2 * 1000, force: false, maxVisible: 3, killer: false, closeWith: ['click'] }; special = { 'success': { type: 'success' }, 'error': { type: 'error', timeout: 10 * 1000 }, 'info': { type: 'information' }, 'warn': { type: 'warning' } }; factory = function(type) { var options; options = $.extend({}, def, special[type]); return function(content, opt) { $.extend(options, { text: content }, opt); return _noty(options); }; }; /* #使用 * require['p/Noty'],(Noty)-> Noty.success(content, noty_options) */ return Noty = { 'success': factory('success'), 'error': factory('error'), 'warn': factory('warn'), 'info': factory('info'), 'alert': factory('') }; }); }).call(this);