flight-for-rails 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 62d2d612ed97ecfdeb034b7d5f0db1e5f38ed45b
4
- data.tar.gz: 38d9f9c9577dc55699f0b13b08a58ba7bddcc3b0
3
+ metadata.gz: 741af4a16bd9eb02367c0cfa895e910b2bd73f4d
4
+ data.tar.gz: 82fd4ccea64d9c8d5852a0114bbdc27999dfa34c
5
5
  SHA512:
6
- metadata.gz: 0ba2b132add231cf69518cfd888d68a2f8332d2c7e780670db8db5764d1d977659451b7ece80fa8f7901b4080dfd0031d9f8ba05e0bc9828c76592071aa5d7f2
7
- data.tar.gz: 46f47abf0860fac97700018a919dfa9aa996fcf4dde4e791136b80d8e340adb9b95a4c9f8d692e2d1d46a04f4b2c8d5b4e62841320f55f37be9fe4708dbb018c
6
+ metadata.gz: 5ee9aabe9012316d7222f53e8f6d559c5da63440aee3ed252249c549a0f54987f03bca2aa90c13f7bb5f3b2aec3d292017379c2fb54faa0b8496bb6373a1c584
7
+ data.tar.gz: 68920a92c5a039d0a8cadf6cfba11ebfcbe9d38a6d098fdff05ed26db6a9b6e21c538076b75a20d118b7f99a8d5a5ba0eab4b6d4b68f4c258d4a9ae8964b34d4
data/README.md CHANGED
@@ -16,7 +16,7 @@ This gem vendors Flight files and dependecies for Rails assets pipeline.
16
16
  First add the following lines to your application `Gemfile`:
17
17
 
18
18
  ``` ruby
19
- gem 'flight-for-rails', '~> 1.1.0'
19
+ gem 'flight-for-rails', '~> 1.1.1'
20
20
  ```
21
21
 
22
22
  Then run `bundle install` to update your's gems bundle.
@@ -1,3 +1,3 @@
1
1
  module FlightForRails
2
- VERSION = '1.1.0'
2
+ VERSION = '1.1.1'
3
3
  end
@@ -1,4 +1,4 @@
1
- /*! Flight v1.1.0 | (c) Twitter, Inc. | MIT License */
1
+ /*! Flight v1.1.1 | (c) Twitter, Inc. | MIT License */
2
2
  (function(context) {
3
3
  var factories = {}, loaded = {};
4
4
  var isArray = Array.isArray || function(obj) {
@@ -64,6 +64,7 @@
64
64
  // http://opensource.org/licenses/MIT
65
65
  // ==========================================
66
66
  define('lib/utils', [], function () {
67
+ 'use strict';
67
68
  var arry = [];
68
69
  var DEFAULT_INTERVAL = 100;
69
70
  var utils = {
@@ -94,13 +95,13 @@ define('lib/utils', [], function () {
94
95
  if (base) {
95
96
  Object.keys(extra || {}).forEach(function (key) {
96
97
  if (base[key] && protect) {
97
- throw Error('utils.push attempted to overwrite \'' + key + '\' while running in protected mode');
98
+ throw new Error('utils.push attempted to overwrite "' + key + '" while running in protected mode');
98
99
  }
99
100
  if (typeof base[key] == 'object' && typeof extra[key] == 'object') {
100
- //recurse
101
+ // recurse
101
102
  this.push(base[key], extra[key]);
102
103
  } else {
103
- //no protect, so extra wins
104
+ // no protect, so extra wins
104
105
  base[key] = extra[key];
105
106
  }
106
107
  }, this);
@@ -209,13 +210,18 @@ define('lib/utils', [], function () {
209
210
  };
210
211
  return utils;
211
212
  });
213
+ // ==========================================
214
+ // Copyright 2013 Twitter, Inc
215
+ // Licensed under The MIT License
216
+ // http://opensource.org/licenses/MIT
217
+ // ==========================================
212
218
  define('lib/debug', [], function () {
213
- var logFilter;
219
+ 'use strict';
214
220
  //******************************************************************************************
215
221
  // Search object model
216
222
  //******************************************************************************************
217
223
  function traverse(util, searchTerm, options) {
218
- var options = options || {};
224
+ options = options || {};
219
225
  var obj = options.obj || window;
220
226
  var path = options.path || (obj == window ? 'window' : '');
221
227
  var props = Object.keys(obj);
@@ -273,27 +279,21 @@ define('lib/debug', [], function () {
273
279
  function byName(searchTerm, options) {
274
280
  search('name', 'string', searchTerm, options);
275
281
  }
276
- ;
277
282
  function byNameContains(searchTerm, options) {
278
283
  search('nameContains', 'string', searchTerm, options);
279
284
  }
280
- ;
281
285
  function byType(searchTerm, options) {
282
286
  search('type', 'function', searchTerm, options);
283
287
  }
284
- ;
285
288
  function byValue(searchTerm, options) {
286
289
  search('value', null, searchTerm, options);
287
290
  }
288
- ;
289
291
  function byValueCoerced(searchTerm, options) {
290
292
  search('valueCoerced', null, searchTerm, options);
291
293
  }
292
- ;
293
294
  function custom(fn, options) {
294
295
  traverse(fn, null, options);
295
296
  }
296
- ;
297
297
  //******************************************************************************************
298
298
  // Event logging
299
299
  //******************************************************************************************
@@ -336,7 +336,7 @@ define('lib/debug', [], function () {
336
336
  eventNames: window.localStorage && localStorage.getItem('logFilter_eventNames') || defaultEventNamesFilter,
337
337
  actions: window.localStorage && localStorage.getItem('logFilter_actions') || defaultActionsFilter
338
338
  };
339
- //reconstitute arrays
339
+ // reconstitute arrays
340
340
  Object.keys(result).forEach(function (k) {
341
341
  var thisProp = result[k];
342
342
  if (typeof thisProp == 'string' && thisProp !== ALL) {
@@ -379,9 +379,10 @@ define('lib/debug', [], function () {
379
379
  define('lib/compose', [
380
380
  './utils',
381
381
  './debug'
382
- ], function (util, debug) {
382
+ ], function (utils, debug) {
383
+ 'use strict';
383
384
  //enumerables are shims - getOwnPropertyDescriptor shim doesn't work
384
- var canWriteProtect = debug.enabled && !util.isEnumerable(Object, 'getOwnPropertyDescriptor');
385
+ var canWriteProtect = debug.enabled && !utils.isEnumerable(Object, 'getOwnPropertyDescriptor');
385
386
  //whitelist of unlockable property names
386
387
  var dontLock = ['mixedIn'];
387
388
  if (canWriteProtect) {
@@ -438,10 +439,8 @@ define('lib/compose', [
438
439
  // Licensed under The MIT License
439
440
  // http://opensource.org/licenses/MIT
440
441
  // ==========================================
441
- define('lib/advice', [
442
- './utils',
443
- './compose'
444
- ], function (util, compose) {
442
+ define('lib/advice', ['./compose'], function (compose) {
443
+ 'use strict';
445
444
  var advice = {
446
445
  around: function (base, wrapped) {
447
446
  return function composedAround() {
@@ -477,10 +476,11 @@ define('lib/advice', [
477
476
  this[m] = function (method, fn) {
478
477
  compose.unlockProperty(this, method, function () {
479
478
  if (typeof this[method] == 'function') {
480
- return this[method] = advice[m](this[method], fn);
479
+ this[method] = advice[m](this[method], fn);
481
480
  } else {
482
- return this[method] = fn;
481
+ this[method] = fn;
483
482
  }
483
+ return this[method];
484
484
  });
485
485
  };
486
486
  }, this);
@@ -493,7 +493,8 @@ define('lib/advice', [
493
493
  // Licensed under The MIT License
494
494
  // http://opensource.org/licenses/MIT
495
495
  // ==========================================
496
- define('lib/registry', ['./utils'], function (util) {
496
+ define('lib/registry', [], function () {
497
+ 'use strict';
497
498
  function parseEventArgs(instance, args) {
498
499
  var element, type, callback;
499
500
  var end = args.length;
@@ -625,7 +626,7 @@ define('lib/registry', ['./utils'], function (util) {
625
626
  instance.addBind(event);
626
627
  }
627
628
  };
628
- this.off = function (el, type, callback) {
629
+ this.off = function () {
629
630
  var event = parseEventArgs(this, arguments), instance = registry.findInstanceInfo(this);
630
631
  if (instance) {
631
632
  instance.removeBind(event);
@@ -637,8 +638,9 @@ define('lib/registry', ['./utils'], function (util) {
637
638
  }
638
639
  }
639
640
  };
640
- //debug tools may want to add advice to trigger
641
- registry.trigger = new Function();
641
+ // debug tools may want to add advice to trigger
642
+ registry.trigger = function () {
643
+ };
642
644
  this.teardown = function () {
643
645
  registry.removeInstance(this);
644
646
  };
@@ -658,13 +660,19 @@ define('lib/registry', ['./utils'], function (util) {
658
660
  }
659
661
  return new Registry();
660
662
  });
663
+ // ==========================================
664
+ // Copyright 2013 Twitter, Inc
665
+ // Licensed under The MIT License
666
+ // http://opensource.org/licenses/MIT
667
+ // ==========================================
661
668
  define('lib/base', [
662
669
  './utils',
663
670
  './registry',
664
671
  './debug'
665
672
  ], function (utils, registry, debug) {
666
- //common mixin allocates basic functionality - used by all component prototypes
667
- //callback context is bound to component
673
+ 'use strict';
674
+ // common mixin allocates basic functionality - used by all component prototypes
675
+ // callback context is bound to component
668
676
  var componentId = 0;
669
677
  function teardownInstance(instanceInfo) {
670
678
  instanceInfo.events.slice().forEach(function (event) {
@@ -743,7 +751,7 @@ define('lib/base', [
743
751
  type = arguments[0];
744
752
  }
745
753
  if (typeof originalCb != 'function' && typeof originalCb != 'object') {
746
- throw new Error('Unable to bind to \'' + type + '\' because the given callback is not a function or an object');
754
+ throw new Error('Unable to bind to "' + type + '" because the given callback is not a function or an object');
747
755
  }
748
756
  callback = originalCb.bind(this);
749
757
  callback.target = originalCb;
@@ -789,8 +797,9 @@ define('lib/base', [
789
797
  return this.$node.find(this.attr[attributeKey]);
790
798
  };
791
799
  this.initialize = function (node, attrs) {
792
- attrs = attrs || {};
793
- this.identity = componentId++;
800
+ attrs || (attrs = {});
801
+ //only assign identity if there isn't one (initialize can be called multiple times)
802
+ this.identity || (this.identity = componentId++);
794
803
  if (!node) {
795
804
  throw new Error('Component needs a node');
796
805
  }
@@ -801,8 +810,8 @@ define('lib/base', [
801
810
  this.node = node;
802
811
  this.$node = $(node);
803
812
  }
804
- //merge defaults with supplied options
805
- //put options in attr.__proto__ to avoid merge overhead
813
+ // merge defaults with supplied options
814
+ // put options in attr.__proto__ to avoid merge overhead
806
815
  var attr = Object.create(attrs);
807
816
  for (var key in this.defaults) {
808
817
  if (!attrs.hasOwnProperty(key)) {
@@ -828,10 +837,8 @@ define('lib/base', [
828
837
  // Licensed under The MIT License
829
838
  // http://opensource.org/licenses/MIT
830
839
  // ==========================================
831
- define('lib/logger', [
832
- './compose',
833
- './utils'
834
- ], function (compose, util) {
840
+ define('lib/logger', ['./utils'], function (utils) {
841
+ 'use strict';
835
842
  var actionSymbols = {
836
843
  on: '<-',
837
844
  trigger: '->',
@@ -847,13 +854,13 @@ define('lib/logger', [
847
854
  ].join(result) : result;
848
855
  }
849
856
  function log(action, component, eventArgs) {
850
- var name, elem, fn, fnName, logFilter, toRegExp, actionLoggable, nameLoggable;
857
+ var name, elem, fn, logFilter, toRegExp, actionLoggable, nameLoggable;
851
858
  if (typeof eventArgs[eventArgs.length - 1] == 'function') {
852
859
  fn = eventArgs.pop();
853
- fn = fn.unbound || fn; //use unbound version if any (better info)
860
+ fn = fn.unbound || fn; // use unbound version if any (better info)
854
861
  }
855
862
  if (typeof eventArgs[eventArgs.length - 1] == 'object') {
856
- eventArgs.pop(); //trigger data arg - not logged right now
863
+ eventArgs.pop(); // trigger data arg - not logged right now
857
864
  }
858
865
  if (eventArgs.length == 2) {
859
866
  elem = eventArgs[0];
@@ -880,13 +887,13 @@ define('lib/logger', [
880
887
  }
881
888
  function withLogging() {
882
889
  this.before('trigger', function () {
883
- log('trigger', this, util.toArray(arguments));
890
+ log('trigger', this, utils.toArray(arguments));
884
891
  });
885
892
  this.before('on', function () {
886
- log('on', this, util.toArray(arguments));
893
+ log('on', this, utils.toArray(arguments));
887
894
  });
888
- this.before('off', function (eventArgs) {
889
- log('off', this, util.toArray(arguments));
895
+ this.before('off', function () {
896
+ log('off', this, utils.toArray(arguments));
890
897
  });
891
898
  }
892
899
  return withLogging;
@@ -905,8 +912,9 @@ define('lib/component', [
905
912
  './logger',
906
913
  './debug'
907
914
  ], function (advice, utils, compose, withBase, registry, withLogging, debug) {
915
+ 'use strict';
908
916
  var functionNameRegEx = /function (.*?)\s?\(/;
909
- //teardown for all instances of this constructor
917
+ // teardown for all instances of this constructor
910
918
  function teardownAll() {
911
919
  var componentInfo = registry.findComponentInfo(this);
912
920
  componentInfo && Object.keys(componentInfo.instances).forEach(function (k) {
@@ -938,11 +946,10 @@ define('lib/component', [
938
946
  throw new Error('Component needs to be attachTo\'d a jQuery object, native node or selector string');
939
947
  }
940
948
  var options = utils.merge.apply(utils, args);
949
+ var componentInfo = registry.findComponentInfo(this);
941
950
  $(selector).each(function (i, node) {
942
- var rawNode = node.jQuery ? node[0] : node;
943
- var componentInfo = registry.findComponentInfo(this);
944
- if (componentInfo && componentInfo.isAttachedTo(rawNode)) {
945
- //already attached
951
+ if (componentInfo && componentInfo.isAttachedTo(node)) {
952
+ // already attached
946
953
  return;
947
954
  }
948
955
  new this().initialize(node, options);
@@ -954,8 +961,8 @@ define('lib/component', [
954
961
  function define() {
955
962
  // unpacking arguments by hand benchmarked faster
956
963
  var l = arguments.length;
964
+ // add three for common mixins
957
965
  var mixins = new Array(l + 3);
958
- //add three for common mixins
959
966
  for (var i = 0; i < l; i++)
960
967
  mixins[i] = arguments[i];
961
968
  var Component = function () {
@@ -963,7 +970,7 @@ define('lib/component', [
963
970
  Component.toString = Component.prototype.toString = function () {
964
971
  var prettyPrintMixins = mixins.map(function (mixin) {
965
972
  if (mixin.name == null) {
966
- //function name property not supported by this browser, use regex
973
+ // function name property not supported by this browser, use regex
967
974
  var m = mixin.toString().match(functionNameRegEx);
968
975
  return m && m[1] ? m[1] : '';
969
976
  } else {
@@ -975,7 +982,7 @@ define('lib/component', [
975
982
  if (debug.enabled) {
976
983
  Component.describe = Component.prototype.describe = Component.toString();
977
984
  }
978
- //'options' is optional hash to be merged with 'defaults' in the component definition
985
+ // 'options' is optional hash to be merged with 'defaults' in the component definition
979
986
  Component.attachTo = attachTo;
980
987
  Component.teardownAll = teardownAll;
981
988
  // prepend common mixins to supplied list, then mixin all flavors
@@ -1007,6 +1014,7 @@ define('lib/index', [
1007
1014
  './registry',
1008
1015
  './utils'
1009
1016
  ], function (advice, component, compose, logger, registry, utils) {
1017
+ 'use strict';
1010
1018
  return {
1011
1019
  advice: advice,
1012
1020
  component: component,
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flight-for-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey Rezvanov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-04 00:00:00.000000000 Z
11
+ date: 2013-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails