File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ module.exports = Common;
1313 Common . _nextId = 0 ;
1414 Common . _seed = 0 ;
1515 Common . _nowStartTime = + ( new Date ( ) ) ;
16+ Common . _warnedOnce = { } ;
1617
1718 /**
1819 * Extends the object in the first argument using the object in the second argument.
@@ -358,6 +359,20 @@ module.exports = Common;
358359 }
359360 } ;
360361
362+ /**
363+ * Uses `Common.warn` to log the given message one time only.
364+ * @method warnOnce
365+ * @param ...objs {} The objects to log.
366+ */
367+ Common . warnOnce = function ( ) {
368+ var message = Array . prototype . slice . call ( arguments ) . join ( ' ' ) ;
369+
370+ if ( ! Common . _warnedOnce [ message ] ) {
371+ Common . warn ( message ) ;
372+ Common . _warnedOnce [ message ] = true ;
373+ }
374+ } ;
375+
361376 /**
362377 * Returns the next unique sequential ID.
363378 * @method nextId
You can’t perform that action at this time.
0 commit comments