diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index ae430f57d1..f34a8b2449 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -193,6 +193,7 @@ All definitions files include a header with the author and editors, so at some p * [KineticJS](http://kineticjs.com/) (by [Basarat Ali Syed](https://github.com/basarat)) * [Knockback](http://kmalakoff.github.com/knockback/) (by [Marcel Binot](https://github.com/docgit)) * [Knockout.js](http://knockoutjs.com/) (by [Boris Yankov](https://github.com/borisyankov)) +* [Knockout.Amd.Helpers](https://github.com/rniemeyer/knockout-amd-helpers) (by [David Sichau](https://github.com/DavidSichau/)) * [Knockout.DeferredUpdates](https://github.com/mbest/knockout-deferred-updates) (by [Sebastián Galiano](https://github.com/sgaliano)) * [Knockout.ES5](https://github.com/SteveSanderson/knockout-es5) (by [Sebastián Galiano](https://github.com/sgaliano)) * [Knockout.Mapper](https://github.com/LucasLorentz/knockout.mapper) (by [Brandon Meyer](https://github.com/BMeyerKC)) diff --git a/knockout.amd.helpers/knockout-amd-helpers-tests.ts b/knockout.amd.helpers/knockout-amd-helpers-tests.ts new file mode 100644 index 0000000000..c5d1b62e03 --- /dev/null +++ b/knockout.amd.helpers/knockout-amd-helpers-tests.ts @@ -0,0 +1,23 @@ +// Tests for knockout.projections.d.ts + +/// +/// + +//The baseDir is used in building the path to use in the require statement. If your modules live in the modules directory, then you can specify it globally here. +ko.bindingHandlers.module.baseDir = "blub"; + +//This allows the ability to globally override the function that the module binding calls after loading an AMD module that does not return a constructor. +ko.bindingHandlers.module.initializer= "initialize"; + +//The dispose method name can be globally overriden. This function is optionally called when a module is being removed/swapped. +ko.bindingHandlers.module.disposeMethod ="dispose"; + +//The templateProperty option can be globally set. If defined, when a module is loaded - if it has a property with the key specified here +// (where the value is a string or function), the value of that property will be used as the template for the module. The result is a fully +// self-contained module (i.e. it has its own template, not an external one). +ko.bindingHandlers.module.templateProperty ="test"; + + +ko.amdTemplateEngine.defaultPath = "your/path/to/templates"; +ko.amdTemplateEngine.defaultSuffix = ".template.html"; +ko.amdTemplateEngine.defaultRequireTextPluginName = "text"; \ No newline at end of file diff --git a/knockout.amd.helpers/knockout-amd-helpers.d.ts b/knockout.amd.helpers/knockout-amd-helpers.d.ts new file mode 100644 index 0000000000..34d4eb0271 --- /dev/null +++ b/knockout.amd.helpers/knockout-amd-helpers.d.ts @@ -0,0 +1,34 @@ +// Type definitions for knockout-amd-helpers +// Project: https://github.com/rniemeyer/knockout-amd-helpers +// Definitions by: David Sichau +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + + +interface KnockoutAMDModule { + baseDir: string; + initializer: string; + disposeMethod: string; + templateProperty: string; +} + +interface KnockoutAMDTemplate { + defaultPath: string; + defaultSuffix: string; + defaultRequireTextPluginName: string; +} + +interface KnockoutBindingHandlers { + module: KnockoutAMDModule; +} +interface KnockoutStatic { + + amdTemplateEngine: KnockoutAMDTemplate +} + +declare module "knockout-amd-helpers" { + export = ko; +} + +declare var ko: KnockoutStatic;