#Methods

#Subscribe

#noConflict

.noConflict(): this

If a Subscribe object already exists in the global object of the current page, the Subscribe.js library will be renamed to PooolSubscribe and the original Subscribe object will be restored.

#init

.init(appId: String): ElementsFactory

Creates a new Subscribe instance (required to display any elements) using your app ID.

#ElementsFactory

#createAuthElement

.createAuthElement(name: String, options: Object): Promise<AuthElement>

Create a new auth element instance.

#name

  • Type: string
  • Accepted values: 'signin-button', 'signin-with-subscribe-button'
The name of the auth element you want to create.
Available elements:
  • signin-button: Displays a signin button that redirects to your Subscribe platform
  • signin-with-subscribe-button: Displays the same signin button as signin-button, but also adds a Subscribe from X/mo button that displays any offer price of your choice.

#Options

#target
  • Type: String|Element
  • Default: 'body'
CSS selector or DOM element that will contain the auth element.
#offer
  • Type: String
  • Default: null
Slug of the offer you want to highlight inside the signin-with-subscribe-button element (will display Subscribe from *price of the selected offer*)
#styles
  • Type: Object
  • Default: null
Allows you to add custom styles to your auth elements.

#config

.config(optionName: String, optionValue: Any, readOnly?: Boolean): this

.config(options: Object, readOnly?: Boolean): this

Allows to set some configuration options. See the configuration options documentation.

#getUser

.getUser(): Promise<UserModel>
Retrieve the currently-authenticated user information. Returns undefined if no user is authenticated.
This methods returns a UserModel object, which looks like this:

#signout

.signout(): Promise<this>
Disconnect the current user.

#on

.on(name: String, callback: Function): this

Allows to set a callback to be called when a specific event is triggered. See the events documentation.

#once

.once(name: String, callback: Function): this
Same as .on() but the callback will be called only once and removed afterwards.

#off

.off(name: String, callback: Function): this
Allows to remove an event callback previously set with .on() or .once().

#AuthElement

#destroy

.destroy(): Promise<null>
Destroys the element.