Skip to content

Commit

Permalink
Add Typings directory.
Browse files Browse the repository at this point in the history
Add Typings JSON file, definition file and README describing how to
install using typings.
  • Loading branch information
drewsilcock committed Feb 20, 2018
1 parent b45bec7 commit bb82ada
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 0 deletions.
10 changes: 10 additions & 0 deletions typings/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Phaser Kinetic Scrolling Plugin Typings

To install using Typings:

```
$ npm install -g typings # If you haven't got it already
$ typings install --save --global github:jdnichollsc/Phaser-Kinetic-Scrolling-Plugin/typings # You should really specify a commit version i.e. github:jdnichollsc/Phaser-Kinetic-Scrolling-Plugin/typings#GIT_COMMIT_HASH_HERE
```

Note that Typings is officially depracated - a more modern approach would be to create a PR onto https://github.com/DefinitelyTyped/DefinitelyTyped so that you can use the now standard `npm install @types/phaser-kinectic-scrolling-plugin` command.
80 changes: 80 additions & 0 deletions typings/phaser-kinetic-scrolling-plugin.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
declare module Phaser {
module Plugin {
/**
* Settings to change behaviour of Kinetic Scrolling plugin.
*/
interface KineticScrollingSettings {
/**
* Enable or disable the kinematic motion.
*/
kineticMovement?: boolean;

/**
* The rate of deceleration for the scrolling.
*/
timeConstantScroll?: number;

/**
* Enable or disable the horizontal scrolling.
*/
horizontalScroll?: boolean;

/**
* Enable or disable the vertical scrolling.
*/
verticalScroll?: boolean;

/**
* Enable or disable the horizontal scrolling with the mouse wheel.
*/
horizontalWheel?: boolean;

/**
* Enable or disable the vertical scrolling with the mouse wheel.
*/
verticalWheel?: boolean;

/**
* Delta increment of the mouse wheel.
*/
deltaWheel?: number;
}

/**
* Kinetic Scrolling is a Phaser plugin that allows vertical and horizontal scrolling with kinetic motion.
* It works with the Phaser.Camera
*/
export class KineticScrolling extends Phaser.Plugin {
/**
* @param game The Game object is the instance of the game, where the magic happens.
* @param parent The object that owns this plugin, usually Phaser.PluginManager.
*/
constructor(game: Phaser.Game, parent: Phaser.PluginManager);

/**
* Start the Plugin.
*/
public start(): void;

/**
* Stop the Plugin.
*/
public stop(): void;

/**
* Change Default Settings of the plugin
* @param options Object that contain properties to change the behavior of the plugin.
*/
public configure(options: KineticScrollingSettings): void;
}
}

interface Game {
/**
* Instance of the plugin that handles kinetic scrolling with mouse, dragging or mouse wheel.
*/
kineticScrolling: Plugin.KineticScrolling;
}
}

declare module "phaser-kinetic-scrolling-plugin" { }
6 changes: 6 additions & 0 deletions typings/typings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "Phaser-Kinetic-Scrolling-Plugin",
"main": "phaser-kinetic-scrolling-plugin.d.ts",
"files": [],
"global": true
}

0 comments on commit bb82ada

Please sign in to comment.