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

TypeError: this.options.adapter.init is not a function #3

Open
austincondiff opened this issue Jun 25, 2015 · 3 comments
Open

TypeError: this.options.adapter.init is not a function #3

austincondiff opened this issue Jun 25, 2015 · 3 comments

Comments

@austincondiff
Copy link

When I attempt to add an adapter like so I get this error.

TypeError: this.options.adapter.init is not a function

My Scrubbing js:

            var BasicAdapter = {
                change : function ( element, value, delta ) { 
                    value = value > 0 ? value : 0;
                    value = value < 100 ? value : 100;
                    element.node.dataset.value = value;
                },
            };

            new Scrubbing ( element[0], { 
                driver : [ 
                    Scrubbing.driver.Mouse,
                    Scrubbing.driver.MouseWheel,
                    Scrubbing.driver.Touch
                ],
                adapter: BasicAdapter
            });

Would you know why this is happening?

@austincondiff
Copy link
Author

I am just trying to set a minimum value of 0 and a maximum value of 100, or a range from 0 to 100. Is there a better way to do this?

@elmisback
Copy link

I also ran into this issue. Your adapter has no init function. To fix:

var BasicAdapter = {
    init: function ( element ) {},
    change : function ( element, value, delta ) { 
        value = value > 0 ? value : 0;
        value = value < 100 ? value : 100;
        element.node.dataset.value = value;
    },
};

The init function is useful if you want to initialize the element's value, but it's extraneous for many use cases. I think it would be nice if the init function weren't required. I can send a pull request for that feature if @FWeinb is interested.

@FWeinb
Copy link
Owner

FWeinb commented Jul 29, 2017

This is code I wrote a long time ago. I don't use this code myself anymore but would be willing to team up to update this libary.

@elmisback elmisback mentioned this issue Jul 29, 2017
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

No branches or pull requests

3 participants