From a18fdfd2f408170ed0b8b200e7cb24f937fa9b58 Mon Sep 17 00:00:00 2001 From: stonio Date: Fri, 7 Jul 2017 18:14:42 +0200 Subject: [PATCH] Create learn-tests.ts --- types/jquery/test/learn-tests.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 types/jquery/test/learn-tests.ts diff --git a/types/jquery/test/learn-tests.ts b/types/jquery/test/learn-tests.ts new file mode 100644 index 0000000000..2ad633eddc --- /dev/null +++ b/types/jquery/test/learn-tests.ts @@ -0,0 +1,20 @@ +import jQueryFactory = require('jquery'); +const jQuery = jQueryFactory(window, true); + +# From https://learn.jquery.com/plugins/basic-plugin-creation/ + +## Basic Plugin Authoring + +interface JQuery { + greenify: GreenifyPlugin; +} + +interface GreenifyPlugin { + (this: JQuery): void; +} + +jQuery.fn.greenify = function() { + this.css( "color", "green" ); +}; + +jQuery( "a" ).greenify(); // Makes all the links green.