Skip to content

1.0.0

Latest
Compare
Choose a tag to compare
@chinchang chinchang released this 04 Jan 11:39
· 2 commits to master since this release

This big major release adds method to start, stop and destroy superplaceholder.

Aslo startOnFocus option is now deprecated. Instead there is a new option called autoStart.

New API:

// Simply auto starts the sentence cycle. focus/blur behaviour stays.
const instance = superplaceholder({
 el: document.querySelector('input'),
 sentences: [ 'Any format works', 'http://yahoo.com', 'www.facebook.com', 'airbnb.com' ],
 options: {
  autoStart: true
 }
})
// Simply auto starts the sentence cycle. Nothing happens on blur and focus now.
const instance = superplaceholder({
 el: document.querySelector('input'),
 sentences: [ 'Any format works', 'http://yahoo.com', 'www.facebook.com', 'airbnb.com' ],
 options: {
  autoStart: true
  onFocusAction: superplaceholder.Actions.NOTHING
  onBlurAction: superplaceholder.Actions.NOTHING
 }
})
// Complete manual control
const instance = superplaceholder({
 el: document.querySelector('input'),
 sentences: [ 'Any format works', 'http://yahoo.com', 'www.facebook.com', 'airbnb.com' ],
 options: {
  onFocusAction: superplaceholder.Actions.NOTHING
  onBlurAction: superplaceholder.Actions.NOTHING
 }
});

// Later, whenever you want
instance.start();
instance.stop();
instance.destroy(); // to completely remove superplaceholder from an input