Download pool/shard010/JavaScript/0062665_watchers-execution.js from Variable-role/sajaniemi_variable_dataset_large: direct link, hf CLI and curl.
- Browser
- Download file 1.13 kB
-
https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/pool/shard010/JavaScript/0062665_watchers-execution.js
- Command line
-
hf download hf://datasets/Variable-role/sajaniemi_variable_dataset_large/pool/shard010/JavaScript/0062665_watchers-execution.js
-
curl -L -o 0062665_watchers-execution.js https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/pool/shard010/JavaScript/0062665_watchers-execution.js
1.13 kB
| /** | |
| * require and specify consistent use `$scope.digest()` or `$scope.apply()` | |
| * | |
| * For the execution of the watchers, the $digest method will start from the scope in which we call the method. | |
| * This will cause an performance improvement comparing to the $apply method, who start from the $rootScope | |
| * | |
| * @version 0.4.0 | |
| * @category conventions | |
| */ | |
| ; | |
| module.exports = function(context) { | |
| var method = context.options[0] || '$digest'; | |
| var methods = ['$apply', '$digest']; | |
| return { | |
| MemberExpression: function(node) { | |
| var forbiddenMethod = methods.filter(function(m) { | |
| return m !== method; | |
| }); | |
| if (forbiddenMethod.length > 0 && node.property.type === 'Identifier' && forbiddenMethod.indexOf(node.property.name) >= 0) { | |
| context.report(node, 'Instead of using the {{forbidden}}() method, you should prefer {{method}}()', { | |
| forbidden: node.property.name, | |
| method: method | |
| }); | |
| } | |
| } | |
| }; | |
| }; | |
| module.exports.schema = [{ | |
| enum: ['$apply', '$digest'] | |
| }]; | |