0.2.2 • Published 3 years ago

psk-typewriter v0.2.2

Weekly downloads
16
License
GPLv3
Repository
github
Last release
3 years ago

psk-typewriter

Vue component to simulate typing text.

Install

Create a new vue project:

vue create

Install component:

npm install --save psk-typewriter

Environment setting

Make a src/resources folder at the root:

mkdir src/resources

Configure the psk-typewriter

Create the src/resources/psk-typewriter.js:

import Vue from "vue";
import TypeWriter from "psk-typewriter";

Vue.use(TypeWriter, { TypeWriterName: "MyTypeWriter" });

Import psk-typewriter

The "src/main.js" file should look like this:

import Vue from "vue";
import App from "./App.vue";

import "./resources/psk-typewriter";

Vue.config.productionTip = false;

new Vue({
    render: h => h(App),
}).$mount("#app");

How to use (example in App.vue)

<template>
    <div>
        <my-type-writer text="And now?" @finished="playExplore = true" />
        <my-type-writer :text="explore" v-if="playExplore" />
    </div>
</template>

<script>
export default {
    data() {
        return {
            playExplore: false,
            explore: "How about we explore the universe?"
        }
    }
}
</script>

Properties

PropertyDescriptionRequiredDefault
endCharCharacter used at the end of the text while it is displayed.no_ (underline char)
textText to displayyes:)
timeoutTime to display the next characterno15
autoscrollScroll the screen to the messagenofalse

Events

EventDescription
finishedWhen the message is all displayed

Using in the browser

To use directly in the browser, import psk-typewriter:

<script src="https://unpkg.com/psk-typewriter" />
0.2.2

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago