Comments (4)
Just tried pasting advice in to http://www.jshint.com/ and only warning I'm getting is that "define" is not declared. Can you shoot me the actual warnings? The jshint file I use to lint is included in the rep: https://github.com/rhysbrettbowen/Backbone.Advice/blob/master/.jshintrc so maybe just having that in the folder with advice will help
from backbone.advice.
Ahh this isn't necessarily about the source code of Advice itself, but rather implementing a mixin. Take for example this mixin:
define(function() {
'use strict';
function addMixin() {
this.setDefaults({});
this.after('initialize', function() {});
}
return addMixin;
});
Both times this
is referenced we get a "Possible strict violation.". This makes sense since this ends up referring to something JSHint doesn't expect. I guess I could do something like following:
define(function() {
'use strict';
var mixin = {
add: function() {
this.setDefaults({});
this.after('initialize', function() {});
}
};
return mixin.add;
});
I was wondering if you've found a better way?
from backbone.advice.
Interestingly enough this seems to pass:
define(function() {
'use strict';
var namer = function() {
this.setDefaults({});
this.after('initialize', function() {});
}
return namer;
});
However, this can result in an unnamed function in older browsers :/. Maybe not so important.
from backbone.advice.
Closing.. ha
from backbone.advice.
Related Issues (9)
- Monkey patch Backbone.extend for better syntactic sugar? HOT 2
- Mixed-in functions can't return values HOT 1
- "Backbone.Advice" object availability check. HOT 2
- Add to bower HOT 3
- Possible 'strict
- Tests don't run with latest version of Karma, tests fail on old version of Karma HOT 4
- wrong return-value when mixing in a previously-unknown method name HOT 4
- Allow addToObj to accept a function that return an object HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from backbone.advice.