Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

types declaration file for typescript user #131

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cdelhomme
Copy link

Here is the typescript declaration file for this plugin.

Here is the typescript declaration file for this plugin.
/// types declaration file for typescript users (https://www.typescriptlang.org)
/// dragdealer.js https://skidding.github.io/dragdealer/

interface DragDealearOption {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cdelhomme Wouldn't DragdealerOptions (plural) be a better name?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And it should be Dragdealer instead of DragDealer.

@cdelhomme
Copy link
Author

you can call the options interface DragdealerOptions if you want. no matter , the only thing is that you do not change the Dragdealer syntaxe for understanding purpose . it should be writen like you call your javascript plugin Dragdealer. .
in fact the use wil be like this :

class sample {
 slider: Dragdealer;

 init(){
   var options:DragdealerOptions = {
   x: 1,
   steps: 2,
   loose: true,
   callback: (x, y) => {
     // Only 0 and 1 are the possible values because of "steps: 2"
     if (!x) {
       this.slider.disable();
       $('#slide-to-unlock-new').fadeOut();
     }
   }
  }
 this.slide = new Dragdealer('slide-to-unlock-new', options);
 }
}

where in typescript the line
slider :Dragdelaer , is to declare a property of the class that will be of Dragdealer type representing by the interface Dragdelaer

its the same for the line
var options:DragdealerOptions = { .....}
we declare and set a variable of type DragdealerOptions .

and when we do the
this.slide = new Dragdealer(...) the new is declare in the interface DragdealerConstructor that return an object symbolize by the interface Dragdealer.

@cdelhomme cdelhomme closed this Oct 31, 2018
@ovidiuch
Copy link
Owner

@cdelhomme Why did you close the PR? I wanted to merge after that small change.

@cdelhomme
Copy link
Author

Sorry i've click on the wrong button

@cdelhomme cdelhomme reopened this Oct 31, 2018
@ovidiuch
Copy link
Owner

No worries! 😄

So are you OK with changing DragDealearOption to DragdealearOptions?

@cdelhomme
Copy link
Author

cdelhomme commented Oct 31, 2018 via email

@cdelhomme
Copy link
Author

no problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants