How to install ? That's the question ?!
NPM | YARN |
---|---|
npm i phosphore |
yarn i phosphore |
To correct use Phosphore...
const { Window } = require('phosphore')
// Create a new Window
var window = new Window()
window.display() // Display the window... You can use .hide(), to hide the window.
To make a new Window your need to call the class Window, and edit it then display. To edit the window you have many tools, to change the title, icon, size of it, etc...
Change the title of the window.
Parameter | Type | Description |
---|---|---|
title | String | The new title |
Change the icon of the window.
Parameter | Type | Description |
---|---|---|
path | Path | The path of the icon/image |
Make sure to use __dirname
before the path!
Set the current scene of the window.
Parameter | Type | Description |
---|---|---|
scene | Scene | The scene to display |
Changed the size (width and height) of the window.
Parameter | Type | Description |
---|---|---|
width | Number | The new width |
height | Number | The new height |
Default Window Size : 720x640
Changed the size (width and height) of the window. Automatically by the ratio of the screen. Approximately 70% of the screen size.
Display the window
Hide the window
@Returns {Number}
- the height of the screen.
@Returns {Number}
- the width of the screen.
Create a new Scene and display a web engine.
Parameter | Type | Description |
---|---|---|
url | String | The URL of the site |
When you want to display your local file, using express :
var { Window } = require("phosphore");
var app = require("express")();
app.use('/', express.static(__dirname + '/YOUR DIR HERE'));
app.listen(3490);
var window = new Window().autoSize().web("http://localhost:3490/")
Called when closing.
Parameter | Type | Description |
---|---|---|
func | Function | The function runned when event is called |
Called when iconified.
Parameter | Type | Description |
---|---|---|
func | Function | The function runned when event is called |
Called when maximized.
Parameter | Type | Description |
---|---|---|
func | Function | The function runned when event is called |
Called when fullscreen state change.
Parameter | Type | Description |
---|---|---|
func | Function | The function runned when event is called |
@Returns {Function}
:
Args | Type | Description |
---|---|---|
oldValue | Boolean | The old value of isFullscreen
|
newValue | Boolean | The new value of isFullscreen
|
Scene are the content of your window. You can create scene as much you want. You can switch by an another scene in your window, and keep the last.
Add a new object in your scene.
Parameter | Type | Description |
---|---|---|
content | Button | An Phosphore Object |
A button is a button ;D
Change the text inside the button.
Parameter | Type | Description |
---|---|---|
text | String | The text you want |
EventHandler of click.
Parameter | Type | Description |
---|---|---|
func | Function | The function to run when a new event |
Rayane Bakkali © 2021