Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Add experimental OmitNew
So you can omit the new keyword for *Layer, Frame and Animation.
- Loading branch information
Showing
with
17 additions
and 1 deletion.
- +2 −1 framer/Extras/Extras.coffee
- +15 −0 framer/Extras/OmitNew.coffee
@@ -1,2 +1,3 @@ | ||
# exports.Hints = require "./Hints" | ||
exports.MobileScrollFix = require "./MobileScrollFix" | ||
exports.MobileScrollFix = require "./MobileScrollFix" | ||
exports.OmitNew = require "./OmitNew" |
@@ -0,0 +1,15 @@ | ||
exports.enable = (module=window) -> | ||
|
||
ClassWrapper = (Klass)-> | ||
CreateWrapper = (args...) -> | ||
if @ is window | ||
return new Klass args... | ||
else | ||
@prototype = new Klass args... | ||
return CreateWrapper | ||
|
||
module.Frame = ClassWrapper(Framer.Frame) | ||
module.Layer = ClassWrapper(Framer.Layer) | ||
module.BackgroundLayer = ClassWrapper(Framer.BackgroundLayer) | ||
module.VideoLayer = ClassWrapper(Framer.VideoLayer) | ||
module.Animation = ClassWrapper(Framer.Animation) |